News for hackers. Stuff that matters.
Re:What I Want from a Type System (2016) by z3t4 on Monday July 01, 2019 @09:04AM (#20324824)
If you find naming things difficult just append the type to the variable name, like strName, strCityName, nrAge, arrUserList, and try to make the types redundant. Then stop using the type annotations when you feel they are unnecessary: strName:string -> strName -> name This of course only works in high level dynamic languages where you wont have 25 ways to represent a number, or 32 ways to make a string (different encodings). In a typed systems level language the compiler should be able to optimize and figure out the best type to use though.
Re:What I Want from a Type System (2016) by golergka on Monday July 01, 2019 @09:55AM (#20325246)
But why would you use the type "string" in the first place, instead of declaring a type "name"?
Re:What I Want from a Type System (2016) by z3t4 on Monday July 01, 2019 @02:19PM (#20328179)
To take it one step further, why does it need to have a type? Why can't the compiler just figure it out?
Re:What I Want from a Type System (2016) by golergka on Monday July 01, 2019 @03:10PM (#20328699)
Because a compiler can't figure out your business requirements?