2 ms·
That's an interesting approach. So the variant name itself doesn't bear the type information but should be uniquely resolved in the type check time, right? It w
by lifthrasiir 3y ago
That's an interesting approach. So the variant name itself doesn't bear the type information but should be uniquely resolved in the type check time, right? It will be pretty much optimal unless you are doing metaprogramming stuffs.
- adamthekiwi99 3y agoThat's right! I think it's a good balance between giving the typechecker the info it needs, but also being flexible in how you can supply it!
- lifthrasiir 3y agoI once pondered about a related generalization: an explicit ellipsis in the identifier. For example `*foo` will match any suitable identifier that ends with `foo`, and it should be uniquely resolved at the end. More ergonomic syntax would use a separator to imply wildcards: for example, an identifier should be a sequence of words separated by `-`, so that `-foo`, `foo-` and `-foo-` really mean `*-foo`, `foo-*` and `*-foo-*` respectively. This can be used to implement a simpler form of module paths.
- andyferris 3y agoFascinating. I'm imagining you're going to want a kick-ass IDE/linter/VSCode plugin to handle the case when you create a new variable that matches an existing pattern, and automatically making existing references more precise. Though it might be easier to go the other way - at the presentation layer, automatically shorten variables to the least specific yet unique suffix or something.