User defined properties signatures

Dicebot via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 21 10:02:59 PDT 2015


This isn't about type system per se but about preferred style of 
syntax. Original example that caused my hatred looked like this: 
`let i : uint = from_str("42")`. Fortunately this has been 
deprecated in favor of `parse` but same principle applies - Rust 
authors encourage you to use declaration for type deduction 
instead of expression.

Same thing can be rewritten as `let i = from_str::<uint>("42")` 
without compromising any type strictness Rust is proud of. In 
this form RHS expression has clear unambiguous type and can be 
copied anywhere. But this is discouraged form. More than that, 
when I was pointing out ugly template syntax, I got some comments 
that it is OK exactly because you are always supposed to put type 
on LHS. This is purely matter of style decisions and it sucks 
hard.


More information about the Digitalmars-d-learn mailing list