Jetbrains Kotlin goes Open Source

63 views
Skip to first unread message

Mark Derricutt

unread,
Feb 14, 2012, 5:14:25 AM2/14/12
to java...@googlegroups.com
Big news!


Java and Javascript compiler - check.
Ant compiler plugin - check.
Maven compiler plugin - check.
Gradle compiler plugin - check.
IDEA Plugin - check.
Eclipse plugin - sadly no check.

Talk about an entrance! I'm looking forward to giving this a ride.

Mark


--
"Great artists are extremely selfish and arrogant things" — Steven Wilson, Porcupine Tree

phil swenson

unread,
Feb 15, 2012, 6:05:32 PM2/15/12
to java...@googlegroups.com
kotlin looks cool in some ways. but it's short on syntactic sugar (no
list/map/reg ext literals). no dynamic types. no personality. so
not sure if anything sets it apart from all the other JVM langs.

I would look more to Groovy/Ruby/Coffeescript for a bit of inspiration.

> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to java...@googlegroups.com.
> To unsubscribe from this group, send email to
> javaposse+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.

clay

unread,
Feb 16, 2012, 12:37:10 AM2/16/12
to The Java Posse
The language looks awesome. It's very Scala like. My hope is that this
fixes the compile time and run time performance problems that Scala
has. It adds compiler level null-safety and generics reification. Will
Kotlin have a standard library? I couldn't see any mention in the web
site.

Unfortunately, this first release is too buggy to use. I'm just trying
to copy/paste and compile the example problems from the web demo.
Obviously, major bugs are to be expected this early.

Mark Derricutt

unread,
Feb 16, 2012, 4:25:34 AM2/16/12
to java...@googlegroups.com
There is a standard library which pimps out the collections API and Strings etc.  but one really AWESOME thing with Kotlin is you might not EVER have to ship that standard library with your application - how you might ask?  inline functions.

Take for example:

"This is a string".doSomething()

inline fun String.doSomething() {
  System.out?.println(this)
}

This defines an inline extension method on the String class, what inline means is that the bytecode for the method is COPIED inline at the callsite.  Debugging will still step into the method (AFAIK) but because the bytecode is inline, you don't need the original classes shipped.

Obviously you wouldn't want to inline LARGE methods tho.

--
"Great artists are extremely selfish and arrogant things" — Steven Wilson, Porcupine Tree


Ricky Clarkson

unread,
Feb 16, 2012, 4:50:49 AM2/16/12
to java...@googlegroups.com
The only thing I can see from a compatibility-with-Java point of view is no easy way of comparing object references without calling equals.

Other than that, the null-tracking system probably means that when working with existing Java code, ?. is the new ., as it assumes all Java references are nullable unless there's an annotation saying otherwise.

It'll be interesting to see whether you can convert an array from Array<String?> to Array<String> (by testing whether each element is null) without fighting against the compiler.
--
Skype: ricky_clarkson


Mark Derricutt

unread,
Feb 16, 2012, 4:58:11 AM2/16/12
to java...@googlegroups.com
I've not tried yet, however you can convert a nullable reference to non-nullable by calling .sure(), as in:

  getUser()?.getLastLoginDate().sure()

will return a non-nullable reference, not sure about Array's tho.


--
"Great artists are extremely selfish and arrogant things" — Steven Wilson, Porcupine Tree



Casper Bang

unread,
Feb 16, 2012, 6:01:10 AM2/16/12
to java...@googlegroups.com
This defines an inline extension method on the String class, what inline means is that the bytecode for the method is COPIED inline at the callsite.  

There's a difference between inlining (which we know from C/C++) and static linking. I'm actually puzzles at why the definition-site "inline" keyword made its way back into Kotlin, compiler heuristics is pretty good at knowing when to inline. It probably has to do with non-local jumps, but that feels like a leaky abstraction and I'd much rather have some kind of call-site inlining then.

Mark Derricutt

unread,
Feb 18, 2012, 8:46:19 PM2/18/12
to java...@googlegroups.com
On further investigation/usage of Kotlin, I may be wrong about not requiring the runtime due to inlining.

Viewing the decompiled class is quite enlightening:


Here we see the various annotations that the Kotlin compiler adds to your classes to support reification of runtime types, and nullability, and parameter names ( for calling named parameters ).  All of these are annotations so can safely be ignored at runtime if the classes are missing, except for the JetObject interface - can't inline that sucker :)

Mark 

--
"Great artists are extremely selfish and arrogant things" — Steven Wilson, Porcupine Tree


On Fri, Feb 17, 2012 at 12:01 AM, Casper Bang <caspe...@gmail.com> wrote:
This defines an inline extension method on the String class, what inline means is that the bytecode for the method is COPIED inline at the callsite.  

There's a difference between inlining (which we know from C/C++) and static linking. I'm actually puzzles at why the definition-site "inline" keyword made its way back into Kotlin, compiler heuristics is pretty good at knowing when to inline. It probably has to do with non-local jumps, but that feels like a leaky abstraction and I'd much rather have some kind of call-site inlining then.

--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To view this discussion on the web visit https://groups.google.com/d/msg/javaposse/-/TAXlsuNlxaoJ.
Reply all
Reply to author
Forward
0 new messages