manuel / wat-js

Concurrency and Metaprogramming for JS
MIT License
259 stars 10 forks source link

Simple addition (support request) #2

Closed xyproto closed 11 years ago

xyproto commented 11 years ago

Hi,

(+ 3 3) works as expected. However, 3+3 gives the answer 3 and +3+3 also gives the answer 3.

Is this on purpose?

Best regards, Alexander Rødseth

manuel commented 11 years ago

Hi.

3+3 is parsed as 3 +3, i.e. two times the number 3.

Likewise, +3+3 is parsed as +3 +3.

If you'd like to see infix addition in Wat, this will never happen, sorry.

xyproto commented 11 years ago

Hi, wasn't looking for infix addition, just wondered why it didn't give an error. Thanks for the explanation.