STATUS
Starting to mess around with https://kotlinlang.org/ … Will update with my findings. #Kotlin has appeal to me because it can compile to #Javascript and is created by the people at JetBrains one makers of the greatest IDEs on the planet.
Like
Award Contribution
Kotlin is pretty cool here is some Javascript created with it
(function (Kotlin) {
'use strict';
var _ = Kotlin.defineRootPackage(null, /** @lends _ */ {
org: Kotlin.definePackage(null, /** @lends _.org */ {
sample: Kotlin.definePackage(null, /** @lends _.org.sample */ {
factorial_za3lpa$: function (n) {
return n === 0 ? Kotlin.Long.ONE : Kotlin.Long.fromInt(n).multiply(_.org.sample.factorial_za3lpa$(n - 1));
},
forOdd_o3xnc2$: Kotlin.defineInlineFunction('sample-library.org.sample.forOdd_o3xnc2$', function ($receiver, f) {
var tmp$0;
tmp$0 = $receiver.iterator();
while (tmp$0.hasNext()) {
var element = tmp$0.next();
if (element % 2 === 1)
f(element);
}
})
})
})
});
Kotlin.defineModule('sample-library', _);
}(Kotlin));
Like
Award Contribution
Original Kotlin code
package org.sample
fun factorial(n: Int): Long = if (n == 0) 1 else n * factorial(n - 1)
inline fun IntRange.forOdd(f: (Int) -> Unit) {
this.forEach { if (it % 2 == 1) f(it) }
}
Like
Award Contribution
Conclusion is that it works great if your using the JVM but maybe not so great if you need to NodeJs just yet … The tooling just isn’t there yet but when theres a webpack plugin or a node require hook it certainly can live side by side our Javascript code.
Leave a reply...
DISCOVER
HIRE
ACTIVITY
FEED