
Kotlin: statically typed programming language that compiles to JVM & JavaScript - amarsahinovic
http://kotlin.jetbrains.org/
======
dysoco
I don't know why would I want to use this and not Scala. Sure, Scala might
have some complexity, but it's easy to learn and for me it's as productive as
Python.

I found this comparision:
[http://confluence.jetbrains.net/display/Kotlin/Comparison+to...](http://confluence.jetbrains.net/display/Kotlin/Comparison+to+Scala)
so basically Kotlin seems to be a "watered" Scala.

~~~
ajselvig
For some people, after looking at Scala a bit, being "watered" might be a good
thing. Kotlin doesn't have as many syntax surprises as Scala does.

That being said, the one really cool feature Kotlin has that Scala doesn't is
the ability to build strongly-typed builder DSLs:

[http://confluence.jetbrains.net/display/Kotlin/Type-
safe+Gro...](http://confluence.jetbrains.net/display/Kotlin/Type-safe+Groovy-
style+builders)

You simply can't accomplish this in Scala with the same elegance.

~~~
vorg
That Kotlin page calls them "Groovy-style", perhaps because many of those
working on Kotlin (e.g. James Strachan, Alex Tkachman) used to develop the
Groovy Language.

But doesn't Ruby also have those builders? Wouldn't it be easy enough for
Scala to implement them in a library if they haven't already? Wouldn't Python
also provide this type of syntax? E.g. a possible translation into Python from
the Kotlin code on the linked page...

    
    
        html:
          head:
            title {"XML encoding with Python"}
          body:
            h1 {"XML encoding with Python"}
            p {"this format can be used as an alternative markup to XML"}
     
            // an element with attributes and text content 
            a(href = "http://python.org") {"Python"}
    
            // mixed content 
            p:
              "This is some" 
              b {"mixed"} 
              "text. For more see the" 
              a(href = "http://python.org") {"Python"} 
              "project" 
            p{"some text"} 
     
            // content generated by 
            p: 
              for (arg in args) arg 
    

So what are they called "Groovy-style" builders for?

~~~
bartonfink
Presumably because, among the languages (and standard libraries) you mentioned
that have implemented this pattern, Groovy is the language that is most
tightly associated with the JVM (which Kotlin is obviously targeting).

~~~
vorg
> Groovy is the language that is most tightly associated with the JVM

That could've been very true 6 years ago, when Groovy 1.0 was released, but
I'd have to challenge that for 2012 (and 2013).

------
factorialboy
The obviously emphasis here with Kotlin is that you can also compile it to
JavaScript. Which may be a smart move for Kotlin.

One reason why I chose Node.js over Scala for my current personal projects is
that I prefer programming in the same language on the client and server.

That being said I've never used Kotlin and can't compare it with Scala, which
I have used for my personal and commercial projects.

~~~
zem
from the other direction, it looks like haxe [<http://haxe.org>] is planning
on adding a java target. fantom [<http://fantom.org>] already does both java
and js too. it's a pretty well-filled ecological niche.

also, if you like single-language stacks, give opa [<http://opalang.org>] a
serious look. it's essentially based on ml, with a javascript skin, and offers
strong static typing and easy integration of front-end and back-end code.

~~~
yareally
I'm glad you brought Opa up. I saw it a while ago and thought it was
interesting, until I saw the license it used (AGPL).

Thankfully, your comment made me seek it out again and I saw they also added
MIT for the framework part, so that apps can be licensed in any language. Will
have to try it out now that they have given users that choice.

------
desireco42
Doesn't look like something I would like to write me code in frankly. It does
say it is for 'industrial' application whatever that means. I would think this
would be for robots, but then why javascript?

Obviously I am not target group.

------
gte910h
If this isn't a scientific targeted language, you should change that to "byte
code" or better yet, "bytecode"

Code is a mass noun when talking to the computer profession.

The science professions still use the (now thought by the computer professions
to be archaic) form "Codes"

------
yati
I like this one! Superficially, the syntax looks like the marriage of Go and
Scala.

------
karthikeleven
or just wait for Java 8(coming in 2013); java 8 supposedly cuts down a lot
verbosity and is sprinkled with functional programming features.

~~~
yati
I think you can use Java 8 features in the latest build of the JDK. Not sure,
though.

------
dotborg
Language without proper IDE(Eclipse) support isn't worth much for me.

ps. i'm not cool enough to use notepad, vim etc.

~~~
jshen
This language is from the people who work on intellij, so it should have good
IDE support in intellij. I haven't tried it myself though.

~~~
cageface
Jetbrains frustrations with implementing Scala support in IntelliJ were at
least part of the motivation for Kotlin.

Since they've designed it with tool support in mind from the beginning I
expect Kotlin to seriously outstrip the other JVM languages in IDE
integration.

------
martinced
They're pretty honest by saying that the point of Kotlin is to drive IntelliJ
IDEA sales (I did buy my licence 70% off during their doomsday special).

However it's a bit weird: they're creating a language that, basically, "needs"
an IDE, so they can sell that IDE. I don't doubt they did put a lot of stuff
in their language at which IDEA was good (e.g. @NotNull / @Nullable which IDEA
was able to check in real-time on partial ASTs etc. which apparently made it
into Kotlin right from the start).

I'm sure there's going to be quite some "refactor xxx to use pattern yyy",
making IDEA "great" to work on Kotlin.

But are these really the features we want? A language that is "flawed" by
design so that we can be sure we _need_ an IDE to develop in it?

I'm still using IDEA and still doing some Java programming.

But I'm more and more investing time in Clojure / Emacs and, honestly, there's
more pleasure to develop with these than with IDEA / Java. I don't know why
IDEA / Kotlin would be any better.

To me it seems that, from the start, it's a language arguing for its own
limitation.

P.S: what about concurrency? does it offer lock-free concurrency? Because
there's no way I'm moving back to using explicit 'synchronized' keywords and
having fun with deadlocks...

~~~
vorg
> A language that is "flawed" by design so that we can be sure we need an IDE
> to develop in it

All languages are flawed by design.

Assembly language is flawed so we need a higher level language like C, with
easier to read syntax. C/C++ is flawed by requiring us to manage heap memory
so we need a managed language like Java/C#. These and Kotlin are flawed
because we need some visual help like name lookups and pattern refactorings.

~~~
mistercow
"Flawed by design" doesn't mean "the design is flawed". It means "it is
designed _to be flawed_ ".

------
dfgdfgdfggf
Sorry for this test :(

