// Implicit return (no semicolon)
x + y
Who thought this was a good idea?
Implicit return is awful, yes. Explicit return is of course fine, and Lisp-style return where it's just the only way to return values is fine, but when you have both you muddle up the logic of how functions work.
Not requiring a semicolon is fine. You typically wouldn't stretch a statement across multiple lines in a way that makes it ambiguous to parse, so 90% of the time the semicolon is just noise. But Javascript's "the semicolon is implied iff there'd be a syntax error otherwise" rule can fuck right off.
But what are you talking about exactly?
There's nothing wrong with Perl-style implicit return. If you want a function to return nothing, you end it with "return;" so it's obvious to anyone reading.
Rust is a write-only language for millennials.
dude, you seem to have very little experience in languages other than C derivatives.
educate yourself tbh.
do some projects in Erlang, OCaml/SML, Haskell, and then think again
Rust is batshit insane. The language will never take off if only because of how special snowflake it tries to be. I mean, it's a high reliability language so I guess some degree of convolution is expected, but then they went out of their way to make it even more complicated.
Anyway, "no return semicolon" is only half of the story. I spent five fucking,minutes looking at an extremely simple short function because I didn't know how did it return anything. Turns out it was the match expression.
How about no?
not an argument. kill yourself nigger
WEW. underage neet fag detected.
Calm down mozilla.
Weak bait.
...
Does this little detail and cool tbh, it allows if/match as expressions about rust warrant a thread?
I love Rust and anything that makes people talk about the language is fine by me tbh fam.
this particular language design aspect is nothing new, it was in Haskell and Erlang and many other important languages decades ago.
...
pajeet went online again?
...
what did they mean by this?
really makes my thought noggins jogging
...
calm down kiddo. i wrote that on my mobile while eyeing the different brands of peanut butter in the supermarket.
also i didn't start with with the kys shit. get your facts sorted out!
Lisp has both.
I didn't know that. Seems like it's specific to Common Lisp, though.