wren
wren copied to clipboard
wren/language: Add unary `+` operator.
For the sake of completeness and to ease pretty formatting, allow numbers to be be prefixed with +.
Well, it's always surprised me that you can't prefix numbers with + anyway.
However, it wouldn't necessarily help with print formatting because you'd need to have some way to tell methods such as System.print to print the + which currently we don't have.
Well, I meant it would help to pretty formatting numbers in code code, not as in print formatting. Sorry for confusion. It is meant to help math people to transfer tables from a source where numbers would always get signed (like scientific or financial stuff), or simply avoid to trigger some OCD is some particular situations XD
Yes, I see what you mean now.
I'd support the change.
I too want the unary + operator (and produced a separate duplicate pull for it). This pull has been sitting for quite a while. Any thoughts on resolving?
Do the changes from the commit work @mhermier?
I made exactly the same changes in the interpreter for my pull (and they work). @mhermier's pull is a better one than the one I submitted in that @mhermier created test cases and adjusted the documentation.