isaacg1 / pyth

Pyth, an extremely concise language. Try it here:
https://pyth.herokuapp.com/
MIT License
262 stars 57 forks source link

Augmented assignment order should be flipped. #97

Closed orlp closed 9 years ago

orlp commented 9 years ago

Now that assignment is an expression the following isn't unambiguous anymore:

+=ZT1

This could mean "Assign T to Z and return Z + 1", or it could mean "Add T to Z and print 1".

I'd suggest that we swap the ordering for augmented assignment:

=+ZT1

There is only one interpretation possible for this - Z += T; print(1).

isaacg1 commented 9 years ago

This is a good idea. Also, I'd like to restructure how syntactic sugar works. I'm going to move it from data.py to pyth.py.

isaacg1 commented 9 years ago

One edge case is that to continue to allow tuple assignment, we should not apply the sugaring to ,.

isaacg1 commented 9 years ago

Implemented.