2 ms·
I don't need types
- crooked-v 8y agoI really wish there was a Typescript mode that did Option/Result style stuff. As it is, there's little to nothing to handle exception throwing or Promise failures.
- tabtab 8y agoThe big problem I found with type-centric languages is that they end up using long chains of types that are hard to reason about. With dynamic languages you usually just have to "match a structure" and don't have a tree of type dependencies to grok and/or tangle up your code. Still I wish it were easy to check the basic type of parameters to avoid surprises. I propose a series of characters to check basic types: # = integer % = decimal/floating number @ = date/time ~ = required (not blank or empty) And it would be "parse-able as" rather than have a hidden type tag inside variables[1]. That's why we don't need a string: everything can be a string. Example: function foo(#myInt, ~@myRequiredDate, %myNumber, myString) { write(myInt, myRequiredDate, etc); } See how compact that is? You don't need the markers inside the function body. [1] I'm against tagged typing, other than for internal optimization. Essentially a programmer can think of every variable as a string, and types a feature of fitting a format (parsing). Tagged types are hard to debug because they are not WYSIWYG: you can't tell from the output what the tag is.