3 ms·
Isn't how all software should be written? Expressions that represent a set of all possible values, effectively replacing the need for types. Surely, such a pla
by miguelrochefort 11y ago
Isn't how all software should be written? Expressions that represent a set of all possible values, effectively replacing the need for types.
Surely, such a platform would make building an app 100 times easier. Not that building apps is a good use of our resources.
- borplk 11y agoI can kinda imagine it but can you elaborate on the part about getting rid of types?
- miguelrochefort 11y agoBy replacing types with arbitrary expressions, you could go beyond just having a list of integers. You could have a list of odd numbers, a list of words starting with "A", a list of ages over 18, a list of prime numbers, a list of at least 5/items, a list of all integers (infinite), etc. You can only access index N of a list whose type expression proves that it has at least 5/items. You can only access the fields of objects that are proven not to be null. You can only give as input to a function that expects an odd number a value whose type expression proves it to be an odd number. Basically, you can never have runtime exceptions.
- infinite8s 11y agoYou are talking about dependent types (https://en.wikipedia.org/wiki/Dependent_type https://en.wikipedia.org/wiki/Dependent_type) and only a few theorem-proving languages support them.
- tinco 11y agoA type is an expression that represents the set of all possible values.. If you don't like making types explicit, you could use implicit typing like in Haskell, or having values carry their types like in Ruby.