Rant after trying Rust a bit
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 23 12:26:57 PDT 2015
On Thursday, 23 July 2015 at 19:20:20 UTC, Jacob Carlborg wrote:
> On 2015-07-23 15:30, Andrei Alexandrescu wrote:
>
>> 1. Inferring function return types when everything is an
>> expression
>> (i.e. last expression there is the return type) may yield WAT
>> results.
>
> I have not had that problem with Scala. Either I want to return
> some thing and let it be inferred, or I don't and declare it as
> Unit (void).
I had a lot of frustration with that (mis)feature and Rust and
find it very unreadable. Because of that, so far I always used
explicit returns in Rust code even if it is not necessary - that
allows to quickly oversee all main exit points of the function.
That is mostly matter of programming culture and hard to
resonably justify in any way. Ironically, that would feel more
"at home" in D than in Rust because normally latter is much more
restrictive and explicit in the code style, such implicit
functional syntax sugar feels very alien in typically verbose and
detailed code.
More information about the Digitalmars-d
mailing list