3 ms·
I agree, the next missing bit is runtime structural typing (not optional of course) that allows constructs like: ``` const whatIsFoo = match (foo) { case :
by mirekrusin 10y ago
I agree, the next missing bit is runtime structural typing (not optional of course) that allows constructs like:
```
const whatIsFoo = match (foo) {
case : nil : "nothing, really"
case : string : "it's a string"
case : number | boolean : "it's bool or number"
case [ head, ...tail ] : string[] : `it's array of strings with head ${head} and tail ${tail.join(', ')}`
case { value } : { type: 'NodeFoo' } : `it's Node Foo with value ${value}`
default: "well, something else."
}
```
- bandrami 10y agoIf only there were a decades-old system that allowed that[1] 1: https://en.wikipedia.org/wiki/Common_Lisp_Object_System https://en.wikipedia.org/wiki/Common_Lisp_Object_System