Coding 2023-08-13
I'm messing a bit more with the Smalltalk-inspired stuff, and I don't think it's going to deliver on its goals of readability, unless I can come up with a better type definition syntax than let type list-of: 'a be nil or cons: 'a onto: list-of: 'a. Either I need to figure out a reasonable way to make that read more like prose, or I need to come up with a more modest goal. Or just scrap the whole thing.
To be honest, I do like the aspect of putting in the parameter's purpose next to its usage. So, maybe I want to focus my efforts on make the usage conform to some standard, and don't worry so much about the definition...
Oh man, I just tried annotating types on a function definition, and I think I actually really like what I came up with.
In that case, now I want to focus on match/switch/case statements. Right now, it's generically ML-ish, which doesn't particularly mesh with the pseudo-English going on around it. Let's look at the parts involved:
- A value, which should be named like a noun.
- A list of pairs.
- The first part of each pair is a destructuring operation, which should be a type constructor, and I've just realized that cons: _ onto: _ doesn't look like a noun phrase. Heck.
- Anyway, the second part can look like any part of speech I come up with, as long as it's consistent for a given statement.
Thinking about it that way implies that, instead of ->, I should be using the second keywords from the various forms of definition. That's no use without something for the beginning to coordinate with it, though.
Hm. If you squint at it hard enough, like maybe really really hard, a match construct kind of looks like an anonymous function that gets pipelined into.
...
Okay, I've got an idea. It's weird, but at this point, it's commit, or be committed. The new syntax I'm trying out is when _ is _ (be|do|then) _, and...
I like it.
I am going to have so much trouble convincing people this isn't an esolang.
Anyway, I'm going to wrap up for tonight, and ponder something else for a bit: should I have an equivalent to rec from OCaml, or just not, like in Koka?
Good night.