mattbierner / khepri

ECMAScript derived programming language
http://khepri-lang.com/
MIT License
67 stars 3 forks source link

Get rid of Unary '-' and '+' operators #54

Closed mattbierner closed 10 years ago

mattbierner commented 10 years ago

Using these for both binary and unary operators is messing up the language, especially with function application. I don't think it is possible to have:

Since the application syntax and insignificant whitespace are more important, the unary versions of these symbols will be removed.

Thoughts on replacement:

0+
0- 

Either as actual unary operators or binary ones with zero. I think the binary one may be confusing with precedence though: 6 * 0-3 would be negative -3 and not -18.

or

++
--

or the symbols

~+ 
~-

From f#. Since ~ is a valid operator however, certain existing unary expressions like ~+10; would silently change.