4 ms·
Tao isn't indentation-sensitive, so nested `match` expressions are ambiguous without the trailing \ branch. I don't know whether I'll keep this syntax though.
by zesterer 4y ago
Tao isn't indentation-sensitive, so nested `match` expressions are ambiguous without the trailing \ branch.
I don't know whether I'll keep this syntax though. I'm increasingly wondering whether it's better to just bite the bullet and go all in with indentation sensitivity.
That said, the existing \ syntax can be quite nice to read: https://github.com/zesterer/tao/blob/master/lib/parse.tao#L50-L55 https://github.com/zesterer/tao/blob/master/lib/parse.tao#L5...
- catlifeonmars 4y agoWhy not just require parents for nested cases? IMO this is fairly unambiguous, even to people unfamiliar with a particular language.
- zesterer 4y agoIn a previous revision of the language, I did! (https://github.com/zesterer/tao/tree/old https://github.com/zesterer/tao/tree/old). I decided against it because, in short, I find the trailing delimiters to be quite ugly. Because this is purely a personal project, I'm thankfully not constrained by such mundane concerns as "ergonomics" (unless such concerns relate to me while I'm working with it). I think Pythonic syntax is probably the way to go long-term though...
- patrickkidger 4y agoPersonally I'm a big fan of Julia's syntax here. Indentation-insensitive with the use of the word "end" as the terminator for all types of block. In practice you can lay it out like Python, and the "end"s help you keep track when e.g. you need to place a single expression after some deeply-nested blocks.
- catlifeonmars 4y agoIs indentation actually necessary to parse a block? I think if you have a well defined terminator (a literal keyword token, such as `end`), indentation can just be a function of an autoformatter with no indentation constraints on syntax.
- ratww 4y agoThe \ syntax is my favorite part so far, I’m definitely gonna copy it for my toy language, hope that’s ok ;)
- zesterer 4y agoGo for it! IIRC it was suggested by someone else in the #langdev channel on the Rust Community Discord, so I can't claim to own the idea.