4 ms·
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 the
by lokedhs 6y ago
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.
- Erlich_Bachman 6y agoIt sounds like you are describing Groovy (which was mature even before Kotlin BTW).
- dehrmann 6y ago> 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.
- chin7an 6y agoCheckout 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/ http://www.jooq.org/
- Retozi 6y agowe 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
- listenallyall 6y agoAlso, props to the primary developer Lucas, who directly replied to my questions within a day, twice
- mirekrusin 6y agoString 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/Reference/Template_literals#tagged_templates https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... [1] https://github.com/appliedblockchain/tsql https://github.com/appliedblockchain/tsql
- vbezhenar 6y agoPL/SQL?
- brabel 6y agoYou 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/groovy-ginq/src/spec/doc/ginq-userguide.adoc https://github.com/apache/groovy/blob/master/subprojects/gro... Groovy DSLs are much better than Kotlin's.
- dehrmann 6y agoGradle, perhaps unfairly, left me not liking Groovy.
- pjmlp 6y agoWe had that in the past, SQLJ https://en.wikipedia.org/wiki/SQLJ https://en.wikipedia.org/wiki/SQLJ
- crummy 6y agoExposed is a Kotlin SQL library that you might be interested in.
- _old_dude_ 6y ago> 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-translation.html https://cr.openjdk.java.net/~briangoetz/amber/pattern-match-...
- brabel 6y agoGroovy has done dynamic dispatch this way for a decade now.
- pjmlp 6y agoAnd 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.
- the_only_law 6y agoWhat ever happened to it? I recall Groovy and Grails being pretty big in the Java world several years ago.
- pjmlp 6y agoThe 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.
- brabel 6y agoWhere 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.
- jorblumesea 6y agoI 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?
- stevbov 6y agoThis 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 https://www.youtube.com/watch?v=ZyTH8uCziI4&t=2896