- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
new language "Kotlin" from jetbrains
Maybe I'm the last guy to hear about things (it happens enough) but
there's this language here which looks like a more credible effort to be
a better/simpler scala than most:
http://confluence.jetbrains.net/display/Kotlin/Welcome
The "What Kotlin has that Scala has not" list does read like a list of
things I would not mind having:
http://confluence.jetbrains.net/display/Kotlin/Comparison+to+Scala
It makes me sad to see another whole implementation's worth of effort
being poured into something new -- come on guys, you won't be enough
better than scala. I know everyone wants their own baby, but just
imagine what we might accomplish if we didn't all keep re-running the
same opening mile. The scenery up here on mile two, it's nice, you
should come give it a look.
P.S. First mile is long.










Re: new language "Kotlin" from jetbrains
On Thu, Jul 21, 2011 at 12:54 AM, Josh Suereth wrote:
> I would just be happy if the compiler had sugar for easier typeclass
> creation/definition and under the covers it still used implicits. With the
> T : M syntax, if we also had a way to make methoda on M[T] that take a T as
> their first parameter appear to be methods on T without boilerplate, then
> most uses of implicit views are unecessary for me.
+1
That was one of two pieces of typeclass syntactic-sugar I was
advocating here: http://www.scala-lang.org/node/9757
-Ben
Re: new language "Kotlin" from jetbrains
One advantage that Scala could exploit more aggressively is GWT+Scala.
Web client code is a significant percentage of code being written and
maintained nowdays, and having it strongly typed, and in the same
language as the back end will be a huge plus n my opinion
...When it gets there, I wonder how "strategic" that project is considered
to be by the Scala team.
2011/7/20 Josh Suereth <joshua [dot] suereth [at] gmail [dot] com>
Re: new language "Kotlin" from jetbrains
Martin,
I was wondering if you could comment a little bit on the performance
tradeoff of extension functions vs. implicit conversions. When the
Kotlin page claims that Scala wraps values into adapters at runtime
(http://confluence.jetbrains.net/display/Kotlin/Extension+functions),
this seems like a bit of a mischaracterization to me. It's true that
implicits require a rich wrapper to be created at runtime, but
determination of the wrapper, and the actual "wrapping" seem to be
happening at compile-time. There's some debate about this happening on
reddit (http://www.reddit.com/r/programming/comments/iub22/
project_kotlin_a_new_statically_typed_programming/c26rgu0), and I was
hoping you might comment on some of the arguments being made there.
Cheers,
Rob
On Jul 20, 3:02 am, martin odersky wrote:
> On Wed, Jul 20, 2011 at 4:16 AM, Rex Kerr wrote:
> > On Tue, Jul 19, 2011 at 7:29 PM, Paul Phillips wrote:
>
> >> Maybe I'm the last guy to hear about things (it happens enough) but
> >> there's this language here which looks like a more credible effort to be
> >> a better/simpler scala than most:
>
> >> http://confluence.jetbrains.net/display/Kotlin/Welcome
>
> >> The "What Kotlin has that Scala has not" list does read like a list of
> >> things I would not mind having:
>
> >> http://confluence.jetbrains.net/display/Kotlin/Comparison+to+Scala
>
> >> It makes me sad to see another whole implementation's worth of effort
> >> being poured into something new -- come on guys, you won't be enough
> >> better than scala. I know everyone wants their own baby, but just
> >> imagine what we might accomplish if we didn't all keep re-running the
> >> same opening mile. The scenery up here on mile two, it's nice, you
> >> should come give it a look.
>
> >> P.S. First mile is long.
>
> > They've only gone (or planned) a few hundred yards in a direction that
> > Scala hasn't already been.
>
> > The key ones to my eye are
>
> > (1) Extension functions. Much cleaner syntax and better performance than
> > the Pimp My Library pattern using implicits.
>
> Extension functions are shortsighted because they only make a class get new
> methods but do not let it implement new interfaces. In any mature framework,
> the primary reason for a method to exist is to implement some interface.
> Extension functions don't scale up to that usage.
>
> Cheers
>
> -- Martin
Re: Re: new language "Kotlin" from jetbrains
when everything besides "pimp my lib" is irrelevant, then extension functions are the better choice. they are simpler and are guaranteed not to add a performance penaltly. when wrapping stuff at runtime, you cannot be sure in advance what the vm will optimize away and what it won't.
however, implicit conversions are more powerful - wrapping stuff temporarily is just one use case that happens to have to same effect as extension functions. extension functions can't actually wrap/convert an object, so if you want to do that, you'll have to do it manually.
-------- Original-Nachricht --------
> Datum: Wed, 20 Jul 2011 05:28:08 -0700 (PDT)
> Von: Rob Patro
> An: scala-debate
> Betreff: [scala-debate] Re: new language "Kotlin" from jetbrains
> Martin,
>
> I was wondering if you could comment a little bit on the performance
> tradeoff of extension functions vs. implicit conversions. When the
> Kotlin page claims that Scala wraps values into adapters at runtime
> (http://confluence.jetbrains.net/display/Kotlin/Extension+functions),
> this seems like a bit of a mischaracterization to me. It's true that
> implicits require a rich wrapper to be created at runtime, but
> determination of the wrapper, and the actual "wrapping" seem to be
> happening at compile-time. There's some debate about this happening on
> reddit (http://www.reddit.com/r/programming/comments/iub22/
> project_kotlin_a_new_statically_typed_programming/c26rgu0), and I was
> hoping you might comment on some of the arguments being made there.
>
> Cheers,
> Rob
>
> On Jul 20, 3:02 am, martin odersky wrote:
> > On Wed, Jul 20, 2011 at 4:16 AM, Rex Kerr wrote:
> > > On Tue, Jul 19, 2011 at 7:29 PM, Paul Phillips
> wrote:
> >
> > >> Maybe I'm the last guy to hear about things (it happens enough) but
> > >> there's this language here which looks like a more credible effort to
> be
> > >> a better/simpler scala than most:
> >
> > >> http://confluence.jetbrains.net/display/Kotlin/Welcome
> >
> > >> The "What Kotlin has that Scala has not" list does read like a list
> of
> > >> things I would not mind having:
> >
> > >> http://confluence.jetbrains.net/display/Kotlin/Comparison+to+Scala
> >
> > >> It makes me sad to see another whole implementation's worth of effort
> > >> being poured into something new -- come on guys, you won't be enough
> > >> better than scala. I know everyone wants their own baby, but just
> > >> imagine what we might accomplish if we didn't all keep re-running the
> > >> same opening mile. The scenery up here on mile two, it's nice, you
> > >> should come give it a look.
> >
> > >> P.S. First mile is long.
> >
> > > They've only gone (or planned) a few hundred yards in a direction that
> > > Scala hasn't already been.
> >
> > > The key ones to my eye are
> >
> > > (1) Extension functions. Much cleaner syntax and better
> performance than
> > > the Pimp My Library pattern using implicits.
> >
> > Extension functions are shortsighted because they only make a class get
> new
> > methods but do not let it implement new interfaces. In any mature
> framework,
> > the primary reason for a method to exist is to implement some interface.
> > Extension functions don't scale up to that usage.
> >
> > Cheers
> >
> > -- Martin
Re: Re: new language "Kotlin" from jetbrains
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Something akin to newtype/deriving is a better choice than both. There
was a recent related discussion. Leave the wrap/unwrap up to the
compiler ot JVM as Martin says, though this does affect termination
semantics.
On 20/07/11 22:54, Dennis Haupt wrote:
> when everything besides "pimp my lib" is irrelevant, then extension
> functions are the better choice. they are simpler and are
> guaranteed not to add a performance penaltly. when wrapping stuff
> at runtime, you cannot be sure in advance what the vm will optimize
> away and what it won't.
>
> however, implicit conversions are more powerful - wrapping stuff
> temporarily is just one use case that happens to have to same
> effect as extension functions. extension functions can't actually
> wrap/convert an object, so if you want to do that, you'll have to
> do it manually.
>
> -------- Original-Nachricht --------
>> Datum: Wed, 20 Jul 2011 05:28:08 -0700 (PDT) Von: Rob Patro
>> An: scala-debate
>> Betreff: [scala-debate] Re: new
>> language "Kotlin" from jetbrains
>
>> Martin,
>>
>> I was wondering if you could comment a little bit on the
>> performance tradeoff of extension functions vs. implicit
>> conversions. When the Kotlin page claims that Scala wraps values
>> into adapters at runtime
>> (http://confluence.jetbrains.net/display/Kotlin/Extension+functions),
>>
>>
this seems like a bit of a mischaracterization to me. It's true that
>> implicits require a rich wrapper to be created at runtime, but
>> determination of the wrapper, and the actual "wrapping" seem to
>> be happening at compile-time. There's some debate about this
>> happening on reddit
>> (http://www.reddit.com/r/programming/comments/iub22/
>> project_kotlin_a_new_statically_typed_programming/c26rgu0), and I
>> was hoping you might comment on some of the arguments being made
>> there.
>>
>> Cheers, Rob
>>
>> On Jul 20, 3:02 am, martin odersky
>> wrote:
>>> On Wed, Jul 20, 2011 at 4:16 AM, Rex Kerr
>>> wrote:
>>>> On Tue, Jul 19, 2011 at 7:29 PM, Paul Phillips
>> wrote:
>>>
>>>>> Maybe I'm the last guy to hear about things (it happens
>>>>> enough) but there's this language here which looks like a
>>>>> more credible effort to
>> be
>>>>> a better/simpler scala than most:
>>>
>>>>> http://confluence.jetbrains.net/display/Kotlin/Welcome
>>>
>>>>> The "What Kotlin has that Scala has not" list does read
>>>>> like a list
>> of
>>>>> things I would not mind having:
>>>
>>>>> http://confluence.jetbrains.net/display/Kotlin/Comparison+to+Scala
>>>
>>>>>
>>>>>
It makes me sad to see another whole implementation's worth of effort
>>>>> being poured into something new -- come on guys, you won't
>>>>> be enough better than scala. I know everyone wants their
>>>>> own baby, but just imagine what we might accomplish if we
>>>>> didn't all keep re-running the same opening mile. The
>>>>> scenery up here on mile two, it's nice, you should come
>>>>> give it a look.
>>>
>>>>> P.S. First mile is long.
>>>
>>>> They've only gone (or planned) a few hundred yards in a
>>>> direction that Scala hasn't already been.
>>>
>>>> The key ones to my eye are
>>>
>>>> (1) Extension functions. Much cleaner syntax and better
>> performance than
>>>> the Pimp My Library pattern using implicits.
>>>
>>> Extension functions are shortsighted because they only make a
>>> class get
>> new
>>> methods but do not let it implement new interfaces. In any
>>> mature
>> framework,
>>> the primary reason for a method to exist is to implement some
>>> interface. Extension functions don't scale up to that usage.
>>>
>>> Cheers
>>>
>>> -- Martin
Re: Re: new language "Kotlin" from jetbrains
And how about type level programming, or defining type level constraints ?
I see this a compelling use case for implicit params and conversions.
ML
2011/7/20 Dennis Haupt <h-star [at] gmx [dot] de>
Re: new language "Kotlin" from jetbrains
Here's how Kotlin implements reification: "For now, we attach a field
with a TypeInfo object to every instance of a generic class. I'm not
aware of any other reliable ways to reify the type
information" (http://confluence.jetbrains.net/display/Kotlin/Welcome?
focusedCommentId=40703305&#comment-40703305).
Re: Re: new language "Kotlin" from jetbrains
On Wed, Jul 20, 2011 at 2:28 PM, Rob Patro <rob [dot] patro [at] gmail [dot] com> wrote:
See my earlier mail in this thread:
It's pretty straightforward to optimize these wrappers away, either in the compiler or in the JVM. I have so far resisted making them a special case (which we could) because I think that a decent general purpose optimizer should be able to eliminate the object creation and call indirection, generating in effect the same code as an extension method. Scala optimizers evolve more slowly than I would like, but it's no reason to give up and instead throw more features into the language.
-- Martin
Re: Re: new language "Kotlin" from jetbrains
just found:
http://confluence.jetbrains.net/display/Kotlin/Tuples
they have labeled tuples, meaning you can access the attributes by names instead of _1, _2 and so on
this is a feature worth of being copied.
first idea:
val magicTuple:(x,y) = (1,2)
is short for
class aslkdjfsdfh(x:Int,y:Int) extends tuple2(x,y)
val magicTUple = new asd(1,2)
so the caller also benefits from the names.
-------- Original-Nachricht --------
> Datum: Wed, 20 Jul 2011 14:32:12 +0200
> Von: martin odersky
> An: Rob Patro
> CC: scala-debate
> Betreff: Re: [scala-debate] Re: new language "Kotlin" from jetbrains
> On Wed, Jul 20, 2011 at 2:28 PM, Rob Patro wrote:
>
> > Martin,
> >
> > I was wondering if you could comment a little bit on the performance
> > tradeoff of extension functions vs. implicit conversions. When the
> > Kotlin page claims that Scala wraps values into adapters at runtime
> > (http://confluence.jetbrains.net/display/Kotlin/Extension+functions),
> > this seems like a bit of a mischaracterization to me. It's true that
> > implicits require a rich wrapper to be created at runtime, but
> > determination of the wrapper, and the actual "wrapping" seem to be
> > happening at compile-time. There's some debate about this happening on
> > reddit (http://www.reddit.com/r/programming/comments/iub22/
> > project_kotlin_a_new_statically_typed_programming/c26rgu0), and I was
> > hoping you might comment on some of the arguments being made there.
> >
> >
> See my earlier mail in this thread:
>
> It's pretty straightforward to optimize these wrappers away, either in the
> compiler or in the JVM. I have so far resisted making them a special case
> (which we could) because I think that a decent general purpose optimizer
> should be able to eliminate the object creation and call indirection,
> generating in effect the same code as an extension method. Scala
> optimizers
> evolve more slowly than I would like, but it's no reason to give up and
> instead throw more features into the language.
>
Re: Re: new language "Kotlin" from jetbrains
On Wed, Jul 20, 2011 at 9:23 AM, Dennis Haupt <h-star [at] gmx [dot] de> wrote:
Re: Re: new language "Kotlin" from jetbrains
On Wed, Jul 20, 2011 at 6:19 PM, Tom Switzer <thomas [dot] switzer [at] gmail [dot] com> wrote:
Now that we have sucesfully removed case classes inheriting from case classes that design becomes possible again. I agree we should do it.
Cheers
Re: Re: new language "Kotlin" from jetbrains
as a substitute for labeled tuples :
val z = new {val a = 1; val b = 2}
println(z.a)
2011/7/20 Dennis Haupt <h-star [at] gmx [dot] de>
Re: Re: new language "Kotlin" from jetbrains
add some sugar for that, please. like
(x = 1;b = 2) - new and the val should be omitted here
-------- Original-Nachricht --------
> Datum: Wed, 20 Jul 2011 10:16:37 -0400
> Von: "Maxime Lévesque"
> An: Dennis Haupt
> CC: martin odersky , rob [dot] patro [at] gmail [dot] com, scala-debate [at] googlegroups [dot] com
> Betreff: Re: [scala-debate] Re: new language "Kotlin" from jetbrains
> as a substitute for labeled tuples :
>
> val z = new {val a = 1; val b = 2}
>
> println(z.a)
>
>
> 2011/7/20 Dennis Haupt
>
> > just found:
> > http://confluence.jetbrains.net/display/Kotlin/Tuples
> >
> > they have labeled tuples, meaning you can access the attributes by names
> > instead of _1, _2 and so on
> >
> > this is a feature worth of being copied.
> > first idea:
> >
> > val magicTuple:(x,y) = (1,2)
> >
> > is short for
> >
> > class aslkdjfsdfh(x:Int,y:Int) extends tuple2(x,y)
> > val magicTUple = new asd(1,2)
> >
> > so the caller also benefits from the names.
> >
> > -------- Original-Nachricht --------
> > > Datum: Wed, 20 Jul 2011 14:32:12 +0200
> > > Von: martin odersky
> > > An: Rob Patro
> > > CC: scala-debate
> > > Betreff: Re: [scala-debate] Re: new language "Kotlin" from jetbrains
> >
> > > On Wed, Jul 20, 2011 at 2:28 PM, Rob Patro
> wrote:
> > >
> > > > Martin,
> > > >
> > > > I was wondering if you could comment a little bit on the
> performance
> > > > tradeoff of extension functions vs. implicit conversions. When the
> > > > Kotlin page claims that Scala wraps values into adapters at runtime
> > > >
> (http://confluence.jetbrains.net/display/Kotlin/Extension+functions),
> > > > this seems like a bit of a mischaracterization to me. It's true
> that
> > > > implicits require a rich wrapper to be created at runtime, but
> > > > determination of the wrapper, and the actual "wrapping" seem to be
> > > > happening at compile-time. There's some debate about this happening
> on
> > > > reddit (http://www.reddit.com/r/programming/comments/iub22/
> > > > project_kotlin_a_new_statically_typed_programming/c26rgu0), and I
> was
> > > > hoping you might comment on some of the arguments being made there.
> > > >
> > > >
> > > See my earlier mail in this thread:
> > >
> > > It's pretty straightforward to optimize these wrappers away, either in
> > the
> > > compiler or in the JVM. I have so far resisted making them a special
> case
> > > (which we could) because I think that a decent general purpose
> optimizer
> > > should be able to eliminate the object creation and call indirection,
> > > generating in effect the same code as an extension method. Scala
> > > optimizers
> > > evolve more slowly than I would like, but it's no reason to give up
> and
> > > instead throw more features into the language.
> > >
> > > -- Martin
> >
Re: Re: new language "Kotlin" from jetbrains
Not sure how hard (or how much unwanted interaction with existing feature) this kind of
sugar would add, it seems like an "explosive" feature in this regard, unless one introduces something like :
val z = #{a = 1; b = 2}
maybe a macro system might be a generalizable way to introduce this
(...but then you ratchet up the complexity...)
2011/7/20 Dennis Haupt <h-star [at] gmx [dot] de>
Re: Re: new language "Kotlin" from jetbrains
One could maybe go one step further and unify argument lists and tuples. Enabling function composition by name instead of position and other goodies.
BR,
John
Re: new language "Kotlin" from jetbrains
I don't think that all features must "scale" in order to be worthwhile. While loops don't scale very well to complex collection manipulations, but Scala without them would be unusable for high-performance tasks. Operators don't scale beyond 3 or 4 characters before they're indecipherable gibberish, but Scala that required "a plus b" would be awkward to use. Tuples don't scale to large numbers of items, but that doesn't mean that they should be discarded in favor of HLists.
Even if we granted that scalability was a very high priority, I don't think the "mature framework" where your job is to glue together interfaces is the only or even the most interesting direction for scalability. Another area of scalability is to manage large quantities of runtime data, e.g. with millions of objects. GC is a pain in such situations, and there, I'd argue that PML is the one that doesn't scale (not unless escape analysis is perfect), because the cost-per-object gets increasingly expensive as the object churn goes up, while extension functions have fewer limits. There's also scalability in terms of number-of-lines-of-code, and right now the volume of boilerplate per PML pattern is more than an extension function would require (if you just need to add the capability, not the interface).
I'm not saying to get rid of implicit conversions. They're very useful, and if I had to pick one, I'd pick them. But there are cases, including cases where scalability is important, where using implicit conversions for PML is a mediocre substitute for extension functions.
--Rex
Re: new language "Kotlin" from jetbrains
On Wed, Jul 20, 2011 at 9:33 AM, Rex Kerr <ichoran [at] gmail [dot] com> wrote:
It's pretty straightforward to optimize these wrappers away, either in the compiler or in the JVM. I have so far resisted making them a special case (which we could) because I think that a decent general purpose optimizer should be able to eliminate the object creation and call indirection, generating in effect the same code as an extension method. Scala optimizers evolve more slowly than I would like, but it's no reason to give up and instead throw more features into the language.
-- Martin
Re: new language "Kotlin" from jetbrains
So I've been spending a lot of time trying to optimize the Numeric type
class (see https://github.com/azavea/numeric) and I am of two minds on
the issue of whether it's worth doing specific optimization of wrapper
objects created by implicit decorators.
At Scalathon I started working on a compiler plugin to "cut out the
middle man" and translate things like "new Numeric(a).+(b)" directly
into "numeric.plus(a, b)" to avoid the object creation, and performance
problems I noticed in 2.9 (2-3x slow down).
Beyond the plugin (which isn't working yet) I've been going through a
lot of contortions to try to make sure Numeric is running as fast as
possible. So I definitely agree with Rex that it would be nice for
(relatively) low hanging optimization fruit to be picked--otherwise
users are forced to (each independently) determine which constructs are
the fastest and which to avoid.
But on the other hand, in HEAD the performance of my Numeric type class
is *much* better (based on recent tests), and I'm only seeing about a
(roughly) 4% penalty for using the implicit wrappers in the "normal"
case [1]. I'm not sure whether the compiler has started doing specific
optimizations or if it just happens to produce code that Hotspot has an
easier time optimizing. But it does lend some credence to Martin's
position.
That said, at the end of the day I would like things to be fast, and
will probably end up using whatever it takes to get that performance
(e.g. Arrays, while loops, the scala-CL compiler plugin, custom Numeric
type class, etc).
Re: new language "Kotlin" from jetbrains
If your observation is correct then I would be relieved if compiler folks could reproduce and confirm that these are not conjectures anymore and that they have it well under control. It would be a pity that this change gets lost in a future release of the compiler. Me too, I can't help it, but my left imperative brain cringes when an implicit conversion occurs in the back for a simple infix operation.
Thanks,
Sébastien
Re: new language "Kotlin" from jetbrains
On Thu, Jul 21, 2011 at 01:57:41AM +0200, Sébastien Bocq wrote:
> If your observation is correct then I would be relieved if compiler folks
> could reproduce and confirm that these are not conjectures anymore and that
> they have it well under control. It would be a pity that this change gets
> lost in a future release of the compiler. Me too, I can't help it, but my
> left imperative brain cringes when an implicit conversion occurs in the back
> for a simple infix operation.
Paul Phillips talked at Scalathon about how there wasn't enough
performance testing being done on the Scala libraries. Maybe the thing
to do is to try to write up my usecase and submit a patch that adds it
as a performance test (along with the performance numbers I see) so
people working on the compiler and libraries can try to preserve that
performance.
You're right that whatever change(s) improved things may have done so
unintentionally, and that it would be unfortunate if it later vanished
without warning.
Re: new language "Kotlin" from jetbrains
2011/7/21 Erik Osheim <erik [at] plastic-idolatry [dot] com>
Re: new language "Kotlin" from jetbrains
On Wed, Jul 20, 2011 at 4:56 PM, Erik Osheim <erik [at] plastic-idolatry [dot] com> wrote:
Re: new language "Kotlin" from jetbrains
I'm all for having _compiler_ optimizations instead of language features. But assuming that the JVM can handle everything is equivalent, for the medium term, to assuming that Scala is going to run on the Sun JVM where those optimizations exist, and hopefully not on Dalvik or elsewhere where they do not. Of course, optimizations that no JVM can't do, due to lack of information, should have elevated priority. But that doesn't mean that the others should be entirely neglected.
Besides, I think extension functions are just a generalization of what the language already has, namely multiple parameter lists. Suppose you could put the parameter name wherever you please:
def g(a: A)(b: B) = // ...
g(a)(b)
def (a: A)g(b: B) = // ...
(a) g (b)
a g b
def (a: A)(b: B)g = // ...
(a)(b)g
def ~(a: A) = // ...
~ a
def (a: A)~ = // ...
a ~
And if you're going to have multiple parameter lists, why not multiple identifiers? Compare (assuming that Range doesn't already have a by method):
// Existing way to make DSL for int ranges
implicit def x(i: Int) = new { def to(j: Int) = Range.inclusive(i,j) }
implicit def y(r: Range) = new {
def by(k: Int) = if (r.isInclusive) Range.inclusive(r.start,r.end,k) else Range(r.start,r.end,k)
}
// Suggested way to make DSL for int ranges
def (i: Int) to (j: Int) by (k: Int) = Range.inclusive(i,j,k)
This really doesn't make the _language_ spec much more complex. It also doesn't make the expressivity of the language any more complex (except for the variant that would allow more-than-one-initial-parameter). You can already achieve all of this with the existing features, except that it's very clunky to write, has potential performance problems, and leads to strange allowed syntax:
1 to 7 by 3 by 2 // Huh? Is this 1,4,7 or 1,6 or 1,3,5,7??
Finally, keep in mind that the JVM-applied optimizations so far only make things _better_, not identical to a method call. For example, I get ~50% slowdown with x.isNaN compared to java.lang.Double.isNaN, and ~8x slowdown with a max b (for doubles) compared to math.max(a,b).
So I'd argue that extension methods are a special case of a modest increase in flexibility of method parameters, and that if PML is intended to replace extension methods entirely, that a compiler optimization not a JVM optimization is called for (since the best optimizing JVM still can't do it completely or very frequently).
--Rex
Re: new language "Kotlin" from jetbrains
In the spirit of Scala I guess the feature missing here is a good macro system to solve the general case.
Take a look at MorphJ: http://code.google.com/p/morphing/wiki/MorphJ
Besides that. The module as compilation unit thing sounded like a good thing too...
BR,
John
Re: new language "Kotlin" from jetbrains
On 20/07/11 12:16, Rex Kerr wrote:
> (2) NotNull support
This is a step backwards.
Re: new language "Kotlin" from jetbrains
It's a step sideways. If you have to put up with null anyway, which we do with Java interop, and that will last until all Java libraries of great utility have Scala wrappers, then it's nice to have the compiler help you check when things might be null and might not. Any time the compiler can tell me when my assumptions are wrong, I count it as a step forward.
Of course, this can lead to the increased use of nulls instead of more powerful concepts, which would be a step backwards.
--Rex
Re: new language "Kotlin" from jetbrains
On Tue, Jul 19, 2011 at 7:26 PM, Rex Kerr wrote:
> On Tue, Jul 19, 2011 at 10:17 PM, Tony Morris wrote:
>>
>> On 20/07/11 12:16, Rex Kerr wrote:
>> > (2) NotNull support
>> This is a step backwards.
>
> It's a step sideways. If you have to put up with null anyway, which we do
> with Java interop, and that will last until all Java libraries of great
> utility have Scala wrappers, then it's nice to have the compiler help you
> check when things might be null and might not. Any time the compiler can
> tell me when my assumptions are wrong, I count it as a step forward.
>
> Of course, this can lead to the increased use of nulls instead of more
> powerful concepts, which would be a step backwards.
>
> --Rex
NotNullable is the default ... you have to append '?' to a type to
make it Nullable. That seems to me a step forward from both Java and
Scala, where all reference types are always Nullable ... although I do
see the point about the psychology that, since '?' is a language
feature, you're expected to do things that way. But at least, if you
do use the feature, your code is typechecked and you can't get runtime
NPE's from Kotlin (as opposed to interop) code except for
initialization order problems.
Re: new language "Kotlin" from jetbrains
JetBrains has an enormous advantage on that (naturally). I think Scala has ~12-18 months before Kotlin hits the 1.0.
--Nikita Ivanov, CEOGridGain Systems www.gridgain.com
On Tue, Jul 19, 2011 at 4:29 PM, Paul Phillips <paulp [at] improving [dot] org> wrote:
Re: new language "Kotlin" from jetbrains
Compiler support for the IDE was a first-class consideration when MS was developing the initial .NET language suite (C#, C++, and VB). I recall reading a blog post (from MS) about how compiler design has been fundamentally changed as a result of taking into account the IDE as the primary consumer of the compiler's functionality.
Agreed that JB has a massive advantage in the IDE arena, but getting to a 1.0 for a new language is still pretty far from attaining wide-spread adoption, Scala is not Kotlin's only competitor. -- Jim Powers
Re: new language "Kotlin" from jetbrains
--Russ P.
On Tue, Jul 19, 2011 at 4:29 PM, Paul Phillips <paulp [at] improving [dot] org> wrote:
--
http://RussP.us
Re: new language "Kotlin" from jetbrains
The fundamental strength of JetBrains twelve or so years back when it was founded was outstanding output/compensation ratio of Eastern European programmers. I recall marveling at the sheer numbers and pedigrees of JetBrain programmers willing to work for so relatively little. That advantage is mostly gone now, as large Eastern European cities became ones of the most expensive in the world to live in, with corresponding salary requirements.
Secondary advantage was strong higher education system built in the Soviet times, pumping out humble and consistently productive local talent. It severely deteriorated since then, as education funding was ruthlessly cut and the whole generation of would-be-professors and star students left Eastern European countries in the last couple of decades. Interestingly enough, a virtual carbon-copy of that system is still operational and thriving in India, which partially explains India's increasing strength in software development.
Indication of JetBrains increasing weakness for me personally was the way that the three major Scala IDEs were evolving for the last couple years. I was really surprised that just one person could develop a more useful Scala plugin for NetBeans than the whole mighty JetBrains could for IDEA.
I'm not sure to what degree that phenomenon could be explained by the fresher, better organized NetBeans code base, the differences in talent of corresponding developers, and lack of strategic vision on the JetBrains part, yet the subjective fact for me was that JetBrains seriously dropped the ball on this one. There was a two-three-year period of Scala IDE vacuum than they utterly failed to fill.
And now they are throwing in the towel completely, probably being scared by the TypeSafe's progress on Eclipse-based Scala IDE. In general, they are seriously squeezed by the successes of Eclipse-based IDEs and continuing evolution of Visual Studio and XCode. Maybe coming up with the language they can control is a wise competitive response to that situation. Or maybe it is a futile attempt to turn things around, driven mostly by emotion. Frankly, I don't know at this point. Time will tell...
On Tue, Jul 19, 2011 at 6:16 PM, Russ Paielli <russ [dot] paielli [at] gmail [dot] com> wrote:
Re: new language "Kotlin" from jetbrains
Besides the the license concern, isn't it obvious? Writing programming languages is fun, and if you are an IDE company, it's a no-brainer to create a language from scratch so that the language and the tools can move forward in lockstep.
"A few different features" is what makes or breaks a language from a mainstream adoption perspective. You don't know which ones will work until you really try.
-- Cédric
Re: new language "Kotlin" from jetbrains
Le 20/07/2011 04:38, Cédric Beust ♔ a écrit :
> On Tue, Jul 19, 2011 at 6:16 PM, Russ Paielli "A few different features" is what makes or breaks a language from a
> mainstream adoption perspective. You don't know which ones will work
> until you really try.
And I would add that the theory beside Scala and Kotlin is quite
different, and so it does not seems to be like "a few different
features", but much more like "some core fundation features are different"
Re: new language "Kotlin" from jetbrains
On Tuesday 19 July 2011, Francois Armand wrote:
> Le 20/07/2011 04:38, Cédric Beust ♔ a écrit :
> > On Tue, Jul 19, 2011 at 6:16 PM, Russ Paielli
> >
> [...]
>
> > "A few different features" is what makes or breaks a language from
> > a mainstream adoption perspective. You don't know which ones will
> > work until you really try.
>
> And I would add that the theory beside Scala and Kotlin is quite
> different, and so it does not seems to be like "a few different
> features", but much more like "some core fundation features are
> different"
What is the theory upon which Kotlin is based?
Randall Schulz
Re: new language "Kotlin" from jetbrains
On Sat, Jul 23, 2011 at 6:03 PM, Randall R Schulz <rschulz [at] sonic [dot] net> wrote:
The theory of evolution?
Re: new language "Kotlin" from jetbrains
Just adding a function to another type (primitive "pimping") is just one specific application of implicits - and it seems that kotlin team wrongly assumed that that's the only one at all...
I'm surprised they'd allow such a significant comparative drawback for their language.
--Nikita Ivanov, CEOGridGain Systemswww.gridgain.com
Re: new language "Kotlin" from jetbrains
On Sun, Jul 24, 2011 at 12:13 AM, Nikita Ivanov wrote:
> After looking at Kotlin's extension functions in details I think it is a
> major blunder comparing to implicits in Scala. They may be easier to handle
> in IDE (and IDEA's Scala plugin already handles implicits perfectly) - but
> there's no way I can do away without ability to convert one type to another
> at least here in GridGain's code.
> Just adding a function to another type (primitive "pimping") is just one
> specific application of implicits - and it seems that kotlin team wrongly
> assumed that that's the only one at all...
> I'm surprised they'd allow such a significant comparative drawback for their
> language.
The architecture of IDEA actually isn't that well suited to implicits.
You can't perform a global find-usages on one yet. Find usages
underpins many refactorings.
Normally this operation is pretty fast by starting with a text based
search to find all potential call sites; the typing them (using
cached) to see if they actually refer to the target method. However,
the method name does not appear at the call site when using implicit
views (same story for implicit parameters, apply/update methods,
for-comprehensions), so the AST of the entire program must be re-typed
and comprehensively searched. (This isn't implemented in the Scala
Plugin yet, and will be slow.) That limits the ability of the IDE to
scale up to large projects.
Kotlin omits features that are troublesome to the IDE. It's not a
stated goal of the language, but given JetBrain's pedigree its fair to
assume that this (and fast compilation) is as important to them as
presenting a simple language to users. This isn't a criticism: I think
there is a valid trade-off between expressivity of the language and
quality of tools.
-jason
Re: new language "Kotlin" from jetbrains
Jason Zaugg skrev 2011-07-24 09:45:
> Kotlin omits features that are troublesome to the IDE. It's not a
> stated goal of the language, but given JetBrain's pedigree its fair to
> assume that this (and fast compilation) is as important to them as
> presenting a simple language to users. This isn't a criticism: I think
> there is a valid trade-off between expressivity of the language and
> quality of tools.
I'm highly sceptical of any language designed for a specific tool
(especially limitations of a specific tool). IMHO, language should be
tool independent.
/Jesper Nordenberg
Re: Re: new language "Kotlin" from jetbrains
> I'm highly sceptical of any language designed for a specific tool
> (especially limitations of a specific tool). IMHO, language should be
> tool independent.
Agree. Languages shouldn't be "fun" to implement, they should provide a
tool to solve problems.
And if a certain language features makes it 10% easier to solve
problems, it doesn't matter at all if the compiler developer has to work
twice as hard.
Else ... welcome to the Modula/Oberon world, where things are easy to
implement but suck like a black hole.
Bye,
Simon
Re: new language "Kotlin" from jetbrains
Fair enough, but you need to realize that implicits come with their own baggage as well. Just today, somebody on #scala was having a problem because he was not importing a particular implicit.
Think about that for a second: the code was compiling and running fine, but it was not giving the expected result. Importing the correct implicit fixed the problem.
Anyone sufficiently experienced with Scala will probably get a gut feeling that might push them in the right direction to solve this kind of bug, but the simple fact that an import can fundamentally modify the behavior of a program is quite new for anyone familiar with Java.
-- Cédric
Re: new language "Kotlin" from jetbrains
2011/7/24 Cédric Beust ♔ :
> On Sat, Jul 23, 2011 at 3:13 PM, Nikita Ivanov wrote:
>>
>> After looking at Kotlin's extension functions in details I think it is a
>> major blunder comparing to implicits in Scala. They may be easier to handle
>> in IDE (and IDEA's Scala plugin already handles implicits perfectly) - but
>> there's no way I can do away without ability to convert one type to another
>> at least here in GridGain's code.
>> Just adding a function to another type (primitive "pimping") is just one
>> specific application of implicits - and it seems that kotlin team wrongly
>> assumed that that's the only one at all...
>
> Fair enough, but you need to realize that implicits come with their own
> baggage as well. Just today, somebody on #scala was having a problem because
> he was not importing a particular implicit.
> Think about that for a second: the code was compiling and running fine, but
> it was not giving the expected result. Importing the correct implicit fixed
> the problem.
> Anyone sufficiently experienced with Scala will probably get a gut feeling
> that might push them in the right direction to solve this kind of bug, but
> the simple fact that an import can fundamentally modify the behavior of a
> program is quite new for anyone familiar with Java.
If there weren't new stuff, it wouldn't be a new language, now would
it? But the fundamental problem here is one that happens in Java as
well.
Basically, if the code compiled but did not work, then the API was
badly designed. Java has plenty examples of badly designed APIs that
cause plenty of grief, without help of any particular feature bringing
huge benefits with it. You can look back to the first versions of Java
and find examples of such.
So, yes, it IS new. People without Scala experience WILL have problems
that are new to them, no matter how much previous experience they had.
But this is like java.util.Date -- though the language did allow such
a thing, the real problem is bad design.
Re: new language "Kotlin" from jetbrains
Another observation is that implicits are *extremely* centric for almost anything in Scala. It is, without a doubt, is one of the key features of the language (just try to find places where it's not used in core libs...).
Yet - Kotlin dismisses it as a thoughtless over-complication and picks one use case to base their feature on. I understand, of course, that Korlin and Scala are different animals - but that's one feature and Kotlin's reasoning that rubs me the wrong way... --Nikita Ivanov, CEOGridGain Systemswww.gridgain.com
2011/7/23 Cédric Beust ♔ <cedric [at] beust [dot] com>
Re: new language "Kotlin" from jetbrains
2011/7/24 Cédric Beust ♔ <cedric [at] beust [dot] com>
Re: new language "Kotlin" from jetbrains
On 2011-07-24 06:33, Naftoli Gugenheim wrote:
> I'm curious what the missing implicit was.
It was a wrong implicit rather than a missing one. He wanted to use
ScalaQuery with MySQL and was using a wrong driver. The driver itself
and some implicit conversions (which can be specialized by the drivers)
need to be imported. For MySQL this would be:
import org.scalaquery.ql.extended.MySQLDriver.Implicit._
Your code will not compile without those imports. But if you import a
different driver, you will, of course, get the wrong SQL code for your
database.
-sz
Re: new language "Kotlin" from jetbrains
On Sun, Jul 24, 2011 at 11:45 AM, Stefan Zeiger <szeiger [at] novocode [dot] com> wrote:
Re: new language "Kotlin" from jetbrains
-- Cédric
2011/7/23 Naftoli Gugenheim <naftoligug [at] gmail [dot] com>
Re: new language "Kotlin" from jetbrains
On Sat, Jul 23, 2011 at 3:13 PM, Nikita Ivanov wrote:
> After looking at Kotlin's extension functions in details I think it is a
> major blunder comparing to implicits in Scala. They may be easier to handle
> in IDE (and IDEA's Scala plugin already handles implicits perfectly) - but
> there's no way I can do away without ability to convert one type to another
> at least here in GridGain's code.
> Just adding a function to another type (primitive "pimping") is just one
> specific application of implicits - and it seems that kotlin team wrongly
> assumed that that's the only one at all...
> I'm surprised they'd allow such a significant comparative drawback for their
> language.
If they eliminated all such significant comparative drawbacks relative
to Scala, it's hard to see what technical (vs. marketing) motivation
for a new language would be left.
Re: new language "Kotlin" from jetbrains
- Steven
On 24.07.2011, at 00:13, Nikita Ivanov wrote:
Re: new language "Kotlin" from jetbrains
From: http://confluence.jetbrains.net/display/Kotlin/FAQ Does it have IDE support?Yes. The compiler is developed as an IntelliJ IDEA plugin, and user-facing IDE features are there from the very beginning (we make good use of them while debugging and testing).
I expect that the compiler will be pretty fast, and very much designed for interactive IDE use.
--
Jim Powers
Re: new language "Kotlin" from jetbrains
--
Jim Powers