4 ms·
What is with languages that swap args and type? It looks cooler? It says, "Hey look at me, I'm not like those languages your dad used, tee hee!". If I want a si
by newlang 11y ago
What is with languages that swap args and type? It looks cooler? It says, "Hey look at me, I'm not like those languages your dad used, tee hee!". If I want a simple and clear to understand script language on the JVM I'd choose Groovy, in fact, Grails is a pure joy to develop with I've come to find out.
- joesmo 11y agoI think it's because Kotlin and Scala infer types so it's more convenient to write it afterwards, as needed, hopefully not to often.
- swsieber 11y agoThat's an excellent point: optional bits come last.
- deleted 11y ago[deleted]
- Roboprog 11y agoThat was a bit harsh, but oh the irony that C syntax is now considered "normal". Yuck. I admire the bravery of Guido the Python guy for giving C layout orthodoxy the finger when he designed his language. But of course Python doesn't have variables with explicit types to worry about where to put them :-)
- incepted 11y agoFor languages with type inference, this syntax makes the code somewhat cleaner overall. As for Groovy, it's barely statically typed so not really an option for me.
- djur 11y agoKotlin has almost exactly the same declaration syntax as Pascal, which would seem to me to be the platonic ideal of "language your dad used". Postfix type annotations go way back. They permit somewhat less ambiguous syntax for things like function types (see C's infamous function pointer declarations) and play more nicely with type inference (it makes more sense to drop the ': int' in 'a: int' than the 'int' in 'int a'). It's certainly not a radical or nonconformist choice to make while designing a language. It might seem unusual to people whose experience is with C-style declarations, but it really is just replacing one well-known syntax with another, equivalent well-known syntax.