LOGIN
Robert Lancer
Chief Technology Officer at Collaborizm
 · New YorkU.S.
Edit
Delete
Share
Report
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.

1 like 
Like
Share
Robert Lancer
Chief Technology Officer at Collaborizm
 · New YorkU.S.
Edit
Delete
Share
Report

Interesting installed Kotlin via http://sdkman.io/

0 like 
Robert Lancer
Chief Technology Officer at Collaborizm
 · New YorkU.S.
Edit
Delete
Share
Report

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));

0 like 
Robert Lancer
Chief Technology Officer at Collaborizm
 · New YorkU.S.
Edit
Delete
Share
Report

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) }
}
0 like 
Robert Lancer
Chief Technology Officer at Collaborizm
 · New YorkU.S.
Edit
Delete
Share
Report

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.

1 like 
Leave a reply...
DISCOVER
CHAT
ALERTS
-2
DISCUSSIONS
-1
FEED