Re: The Two Problems of the Joy Programming Language
Posted: Feb 13, 2006 5:58 PM
> i think there's an argument to be made for a
> left-concatenative joy which is rooted in the fact that we
> read the code left-to-right. my own mental habits cause
> me to read
> 2 3 + 4 *
> as "push 2, push 3, add, push 4, multiply." so how would
> i read
> * 4 + 3 2
> ? perhaps as
In Unimperative there isn't any operators so that would read:
multiply << 4 << add << 3 << 2;
(multiply << 4) << (add << 3 << 2);
> "multiply the result of pushing 4 onto the result of
> adding the result of pushing 3 after pushing 2," which is,
> i hope you will agree, slightly more awkward. (the
> alternative is to *read* from right-to-left.)
I agree that instructions for doing things makes sense left to right, but the composition of mathematical functions is more natural right to left.
Either way, I am more flexible on this point, then when I original posted. The latest version of Unimperative ( which now has its own website at http://www.unimperative.com ), now provides two concatenation operators ">>" and "<<". I am phasing out the usage of ",". This way people get to have whatever they prefer.
(add << 3 << 2) >> (multiply << 4);
begin >> 3 >> 2 >> add >> 4 >> multiply;
The begin, is a neccessary evil of C++ ">>" operator overloading.