Re:Making Wrong Code Look Wrong (2005)
by imagin8or on Saturday November 09, 2019 @07:00AM
(#21491011)
Yes, though the notation approach is worth following if you cannot use the type system (lang doesn't support it, or incurs unacceptable performance or complexity overhead).
But yeah, zero cost compiler magic is the reason Rust is so good.
Re:Making Wrong Code Look Wrong (2005)
by partyboat1586 on Saturday November 09, 2019 @08:14AM
(#21491318)
I'll be using it in my JavaScript extensively. Very useful in languages with useless type systems.
Re:Making Wrong Code Look Wrong (2005)
by gautam1168 on Saturday November 09, 2019 @08:54AM
(#21491540)
Are you sure you cannot handle this using conditional types in typescript?
Re:Making Wrong Code Look Wrong (2005)
by marcus_holmes on Saturday November 09, 2019 @06:46PM
(#21495340)
Any typed language can do this, not just Rust ;)
Re:Making Wrong Code Look Wrong (2005)
by devicetray0 on Saturday November 09, 2019 @11:09AM
(#21492294)
> GALAXY BRAIN: Apps Hungarian is stupid and just duplicates the work of the type system
Is this correct? From the article, Apps Hungarian represents your intent for the var (the kind), not the type. Systems Hungarian represents the type (duplicative).
Re:Making Wrong Code Look Wrong (2005)
by dmitshur on Saturday November 09, 2019 @11:43AM
(#21492524)
He meant that the intent (kind) can be factored into the type system too. Instead of using type string for both “unsafe string” kind and “safe string” kind, you’d use two different types. So the type system aka compiler can catch a mistake, in addition to your eyes.
For example, see https://talks.golang.org/2012/goforc.slide#43.
Re:Making Wrong Code Look Wrong (2005)
by devicetray0 on Saturday November 09, 2019 @11:53AM
(#21492582)
Oh I see. Thank you!
NORMAL BRAIN: Systems Hungarian may be silly, but Apps Hungarian has some merit
GALAXY BRAIN: Apps Hungarian is stupid and just duplicates the work of the type system