The fewer spaces between an operator and its arguments, the earlier the execution?" I don't know the answer to this, but it did lead me to come up with the following joke language inspired by ill-conceived supposedly "helpful" language features:
- To eliminate hard-to-read brackets, code is evaluated depending on spacing. That is,
3-2 - 1
is0
, but3 - 2-1
is2
. - The multiplication operator is
x
instead of the confusing*
. Yes, the spaces are part of the operator and don't count towards the evaluation order. - Of course, the evaluation order of ambiguously spaced code is undefined.
3 x 2 + 1
may be9
or7
in a valid implementation. - Division is done using nice, readable horizontal divisor lines:
3 --- x
- To eliminate confusing semicolons, periods are instead used to terminate function invocations and blocks:
myfun 3,2.
- To allow flexibility, adding an extra space before a function parameter passes it in by name, which means it's evaluated each time it's used:
myfun 1, foobar 3..
will evaluatefoobar 3.
as many times as it's used, whereasmyfun 1,foobar 3..
evaluates it exactly once. - Our language also supports coroutines! Simply wrap any code in the "aside operator", also known as "brackets":
(myfun 3,2.)
- As a convenient shorthand, any function call terminated with a
!
instead of a.
will exit the program with a code of 1 if the function call returns a falsey value. - The boolean values are
yes
andno
, though they're actually just alternate names for0
and1
. (0 is true to maintain compatibility with unix exit codes.) - Everything but
yes
is falsey, for simplicity's sake. - Variables are declared using the syntax
x is 3.
and changed usingx becomes 3.
. - To prevent arguments over naming, the following variable names are considered the same:
FooBar
,fooBar
,foo_bar
,FOO_BAR
. Butfoobar
is a different variable. - There is also an
alias
command to define aliases of variable names at runtime. The effect of this command is global. It's an excellent tool for multilingual teams. - Comments, since they're important, are enclosed between triple explanation marks.
Finally, here's an example function in this language. Suggestions for "improvements" are very welcome. :D
function isPrime,x,
div is 2.
result is no.
alias r to result.
2
while div < x,
| x |
remainder is x - |---|. !!!Using easy visual representation of the floor function.!!!
_div_
remainder is 0?
r becomes yes.
.
.