Live data from Hacker News

Show HN: The Sage Programming Language

github.com

31–32 of 32 posts

Re: Show HN: The Sage Programming Language

#31

Earlier quoted context omitted.

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.

That'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!

I 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.

Re: Show HN: The Sage Programming Language

#32

Earlier quoted context omitted.

That'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!

I 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 `*…

Fascinating.

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.

Post reply on HN