Since Shirka is a tacit programming language, and the order of "arguments" is uncomon, it can be difficult to reason about what input operations need. In the following example:
while
It is quite natural to think the operation uses two objects from the stack: a value to check and something to do. However it is not clear in what order both objects must be on the stack.
It can be made clearer with the context and the prefix sugar:
([condition] while)
[ doSomething ]
However, doing that is not possible if the lists are generated programmatically. One solution I'm thinking about is to include argument information in the operation's name:
[doSomething] [condition]
while|true -- name reflects the desired stack input
I'm not sure about the |
character, as I would like to reserve its use for
future concurrency features of Shirka. This solution introduces another
problem though: it does not hint if the name indicates the input state or
the outputed result.
while|true -- operation name hinting input
tail|head -- operation name hinting output
Both are desirable, depending on the operation. A fix could be to use different separation characters, or a prefix (though a bit heavy):
while|true tail~head -- differentiate with splitting character
-- (becomes useless with operations acting on
-- only one object)
>while|true <tail|head -- differentiate with prefix notation
-- (cumbersome)
Maybe separating characters could be ,
and '
. I'm not sure.
In any case, it does not change the syntax of the language: such naming conventions are just conventions.