The type system is a programmer's best friend
dusted.codes
The type system is a programmer's best friend
1–10 of 467 posts
Re: The type system is a programmer's best friend
#2Re: The type system is a programmer's best friend
#3[Edit] it also handled things like parallel resistances, etc.
It was in C++ if I recall correctly.
This is a great idea, that I've haven't had cause to use yet.
Re: The type system is a programmer's best friend
#4Honest question, what should multiplying $100 with $20 give?
Re: The type system is a programmer's best friend
#5> ... to prevent silly mistakes like multiplying $100 with £20 Honest question, what should multiplying $100 with $20 give?
Re: The type system is a programmer's best friend
#6> ... to prevent silly mistakes like multiplying $100 with £20 Honest question, what should multiplying $100 with $20 give?
Re: The type system is a programmer's best friend
#7So we have a type for "country of origin". And then some country that you have in the records splits up into 2 countries, what do you do then? Do you keep a list of all countries that ever existed and keep it up to date?
This approach works good in some cases, but not always
Re: The type system is a programmer's best friend
#8> ... to prevent silly mistakes like multiplying $100 with £20 Honest question, what should multiplying $100 with $20 give?
Re: The type system is a programmer's best friend
#9> ... to prevent silly mistakes like multiplying $100 with £20 Honest question, what should multiplying $100 with $20 give?
Re: The type system is a programmer's best friend
#10>A string value is not a great type to convey a user's email address or their country of origin. So we have a type for "country of origin". And then some country that you have in the records splits up into 2 countries, what do you do then? Do you keep a list of all countries that ever existed and keep it up to date? This approach works good in some cases, but not always
You can have your name change as well, or your calendar can change, or etc.
Does that mean we stringly type everything? No. You model changes either via a separate field(s) or some kind of change table.