News for hackers. Stuff that matters.
Re:The Kotlin Foundation by lokedhs on Saturday February 13, 2021 @12:31PM (#26125009)
I started using Java in the 90's and worked for Sun back in the day, so I have a reasonable amount of experience with it.

Kotlin is a much better Java, and these days if I need to use the JVM, I will use Kotlin.

However, I do feel that there is a huge missed opportunity in making something that is not just a better Java, but a better language. Kotlin has a lot of annoying limitations, almost all of which are there because the JVM doesn't allow better implementations using first-class JVM functionality.

One of my favourite examples is multimethods which would be an amazing improvement. However, the JVM can't do dynamic dispatch on multiple arguments, so Kotlin will never get it. Sure, if they implement it, calling Kotlin from Java would be more complicated, but that really shouldn't restrict how the language evolves.

Another thing I'd like to see changed is better support for DSL's. Some nice stuff has been done with the limited facilities that are available, but it always seems like I'm fighting the language when making DSL's. As someone who writes a lot of Lisp, I'd really like to see a macro system.

Re:The Kotlin Foundation by _old_dude_ on Saturday February 13, 2021 @12:47PM (#26125134)
> JVM can't do dynamic dispatch on multiple arguments

It can since Java 7, the instruction invokedynamic was added for this kind of stuff.

The implementation for Pattern Matching (the project Amber) [1] will use the very same instruction.

[1] https://cr.openjdk.java.net/~briangoetz/amber/pattern-match-...

Re:The Kotlin Foundation by brabel on Saturday February 13, 2021 @01:23PM (#26125448)
Groovy has done dynamic dispatch this way for a decade now.
Re:The Kotlin Foundation by pjmlp on Saturday February 13, 2021 @03:51PM (#26126777)
And if it wasn't for Gradle, it would have been forgotten for now.

The language that was supposed to replace Java in JEE and Spring.

Re:The Kotlin Foundation by the_only_law on Saturday February 13, 2021 @03:55PM (#26126811)
What ever happened to it? I recall Groovy and Grails being pretty big in the Java world several years ago.
Re:The Kotlin Foundation by pjmlp on Saturday February 13, 2021 @04:14PM (#26127004)
The interest died off, JUGs stop talking about it and everyone went back to Java, while some of us got money to port those projects back to Java.

Had it not been for Gradle, and there would be hardly a reason to learn it in 2021, other than historical interest.

Re:The Kotlin Foundation by brabel on Sunday February 14, 2021 @03:10AM (#26130523)
Where I work we use Groovy heavily for testing (with the Spock Framework - which is amazing), in our Jenkins pipelines, and for Gradle Plugins in our build.

I see a pretty active community around it and lots of new releases (from the libraries and the language itself) coming up all the time. Your picture of Groovy being dead couldn't be more wrong in my experience.

Re:The Kotlin Foundation by pjmlp on Sunday February 14, 2021 @03:17AM (#26130555)
A programming language is alive as long as there is one developer using it, doesn't mean it still matters at scale.

As mentioned, Gradle is still around.

Re:The Kotlin Foundation by dtech on Sunday February 14, 2021 @06:16AM (#26131366)
Gradle is moving more and more towards kotlin
Re:The Kotlin Foundation by pjmlp on Sunday February 14, 2021 @09:00AM (#26132429)
A language that will share Groovy's fate, when Google gets fed up with Android and uses either ChromeOS or Fuchsia to take its place.
Re:The Kotlin Foundation by stevbov on Saturday February 13, 2021 @07:37PM (#26128520)
This reminds me - a Java language architect was asked what his favorite non-Java JVM language is. He said Clojure because it's not trying to just be a "better Java".

https://www.youtube.com/watch?v=ZyTH8uCziI4&t=2896

Re:The Kotlin Foundation by dehrmann on Saturday February 13, 2021 @12:37PM (#26125053)
> Another thing I'd like to see changed is better support for DSL's

I keep waiting for a good solution for SQL in Java (or another language) that isn't a builder or a string with templating. I don't like what React does architecturally, but JSX shows how mixing languages in an elegant-ish way can be huge.

Re:The Kotlin Foundation by chin7an on Saturday February 13, 2021 @12:54PM (#26125197)
Checkout jooq(1) for a SQL DSL in Java. I've used it with MySQL and love it. Trying to convince my employer for the paid version with RDS.

[1] http://www.jooq.org/

Re:The Kotlin Foundation by Retozi on Saturday February 13, 2021 @01:02PM (#26125270)
we use jooq extensively it's probably the most valuable tech in our backend.

Also among various other tech stacks I've never seen something that hits the sweet spot between "plain sql" and "advantages of ORM-stuff" as well as jooq

Re:The Kotlin Foundation by listenallyall on Saturday February 13, 2021 @03:13PM (#26126374)
Also, props to the primary developer Lucas, who directly replied to my questions within a day, twice
Re:The Kotlin Foundation by mirekrusin on Saturday February 13, 2021 @12:55PM (#26125207)
String templating elevated to "tagged templates" [0] which dispatches template on your own function is suprisingly acceptable solution. I'm using it to drive mssql sql generation [1] and it works really well with type system around combinators. It's perfect, extremely lightweight way to achieve embedded dsl like experience.

[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... [1] https://github.com/appliedblockchain/tsql

Re:The Kotlin Foundation by brabel on Saturday February 13, 2021 @01:25PM (#26125466)
You and the PC probably would be happy with Groovy, specially with them adding a SQL DSL now: https://github.com/apache/groovy/blob/master/subprojects/gro...

Groovy DSLs are much better than Kotlin's.

Re:The Kotlin Foundation by dehrmann on Saturday February 13, 2021 @04:46PM (#26127274)
Gradle, perhaps unfairly, left me not liking Groovy.
Re:The Kotlin Foundation by pjmlp on Saturday February 13, 2021 @03:53PM (#26126793)
We had that in the past, SQLJ

https://en.wikipedia.org/wiki/SQLJ

Re:The Kotlin Foundation by crummy on Saturday February 13, 2021 @06:14PM (#26127944)
Exposed is a Kotlin SQL library that you might be interested in.
Re:The Kotlin Foundation by vbezhenar on Saturday February 13, 2021 @12:57PM (#26125220)
PL/SQL?
Re:The Kotlin Foundation by Erlich_Bachman on Saturday February 13, 2021 @12:36PM (#26125040)
It sounds like you are describing Groovy (which was mature even before Kotlin BTW).
Re:The Kotlin Foundation by jorblumesea on Saturday February 13, 2021 @12:58PM (#26125239)
I actually think that once you have Kotlin on top, it might open the door to another VM or bytecode generator. What's the point of having that abstraction if you're so tied to some other company VM?