gilch / hebigo

蛇語(HEH-bee-go): An indentation-based skin for Hissp.
https://github.com/gilch/hissp
Mozilla Public License 2.0
24 stars 3 forks source link

Consider renaming the empty hotword from :: to !: #13

Closed gilch closed 5 years ago

gilch commented 5 years ago

The empty hotword is currently a double colon, like ::. A triple colon is not that rare, like quote::: ... (for '(...)), which gets harder to read, and a quintuple colon, like quote::::: ... (for '((...))) is probably possible. Triple is maybe OK, but quintuple is nuts.

The natural empty hotword would have been :, but that's already a :keyword due to an unfortunate historical collision. And Hissp already uses it to separate single from paired parameters in lambdas, and single from paired arguments in normal calls, so we can't just make it a special case.

Now that we have the !macros, !: would be an option. quote:!:!: ... looks much less bad. I could maybe even implement it as a macro defined in readerless mode, which would simplify the parser.

gilch commented 5 years ago

It didn't actually simplify the parser that much when I tried it. That approach might also make macro writing more difficult.

We could special case it just like ::, but then why use the ! at all? Why even make it short? The idiomatic case should be easier, and I think empty hotwords should usualy be avoided in macro invocations.

Another option would be to use pass: as the empty hotword. It's already a reserved word, and its Python meaning is useless in Hebigo. Using that as the empty hotword is close enough to the Python meaning that it would probably be easy to learn and remember for Pythonistas. The idea is that we're "passing control" to the next element, not that we're skipping the whole block.

gilch commented 5 years ago

'(...) would become quote:pass: ... instead of quote::: ... and '((...)) would become quote:pass:pass: ... instead of the shorter, but much less readable quote::::: ....