Caterpillar

Daily Thought - 2024-10-09

< back to list

The new function syntax I'm considering would require new keywords (fn and end), and thus prevent those names from being used for functions. This is a general problem with keywords, at least those that can't be restricted to a specific context. In this case, both keywords could show up in the same contexts as function calls.

But what if keywords had a special syntax? Like @fn/@end, for example. At first glance, this seems too ugly and visually noisy for something so pervasive. But the editor would do syntax highlighting anyway, making the @ redundant. It could just omit it. Or render it so small as to not hinder readability, while still making it discoverable.

Also consider, that the editor could provide hints and auto-complete. If you type if, it could offer to insert the keyword for you. Taken together, this would make the @ more like a hotkey for typing keywords, less part of the syntax.

<< previous thoughtnext thought >>