And How do you say the opposite of sugar syntax in English? Because my lovely rustlang has a lot of sigil chars as old Perl, it makes me sad.
And How do you say the opposite of sugar syntax in English? Because my lovely rustlang has a lot of sigil chars as old Perl, it makes me sad.
I think you're comparing two different things. Kotlin has "annotations", not decorators. It's because of it's java inheritance, where that is the way it's done. It's two different concepts. With a decorator, your code is replaced with a function call with the function itself as a parameter. With an annotation, you're just adding metadata and an annotation processor or static analysis tool etc can do whatever it wants with it. Like aspect oriented programming. You mark your code as having certain properties, and then other code can find it and react to those.
I don't know of much other useless syntactic sugar in Kotlin? I think most of it is quite nice, for instance how you can put the lambda outside parenthesis or create infix operator for more readable code. I also like the implicit `it` parameter in lambdas, better than what this article shows. Doesn't support multiple arguments, though.
listOf(1,2,3).let { (a, b, c) -> a * b + c }
Which I think it's a good compromiseThe idea behind 'sugar' is 'tasty but inessential', so the strict opposite would be something essential but not so tasty.
But maybe 'syntactic thorns' correspond better to the sense you intend to express.
Syntax spice ? It burns when you eat/read and it burns when you write/poo
> Because my lovely rustlang has a lot of sigil chars as old Perl, it makes me sad.
I unironically prefer Perl mess, at least you don't have macros and annotations generating who-knows-what at random parts of code.
I mean, not that you couldn't in Perl, there is plenty of horrid things you can do using some more obscure Perl's features (my favourite so far was modifying other package's package-scoped variables), but most code in Perl doesn't.
edit —- I just checked, and salt is ‘name dropped’ in the Wikipedia article for syntax sugar, and there were a few more links making me think it is relatively common.