Re:The Curious Case of Swift's Adoption of Smalltalk Keyword...
by wwright on Sunday June 14, 2020 @02:16PM
(#23519906)
This makes me wonder if there is some sort of relationship between currying and row polymorphism; that could be pretty sweet to capture succinctly in a language
Re:The Curious Case of Swift's Adoption of Smalltalk Keyword...
by MrBuddyCasino on Sunday June 14, 2020 @11:10PM
(#23523417)
Args reified as structs, interesting!
On the other hand, not exceptional at all when looking at it from a Lisp angle.
Re:The Curious Case of Swift's Adoption of Smalltalk Keyword...
by eeereerews on Sunday June 14, 2020 @05:40PM
(#23521618)
I've thought about this too, but keeping positional args. The basic data type would be a "blob", consisting of a struct part and a tuple part.
- All arguments are keyword arguments. - Each function implicitly defines a struct type equivalent to its arguments.
I think if you combined this with some nice structural typing you can get a lot of the argument forwarding/builders and similar that people enjoy in dynamic languages without much/any overhead. Rough example:
fn add(a: int, b: int): int { a + b }
fn add3(c: int, rest: add::args): int { add(rest) + 3 }
A somewhat silly example but I think you can see the point. Of course you could also add language-level builder syntax to these structs and have something really nice.
I think the key here is that once you make the arguments a static type you can add loads of convenience like builders very easily.