wren icon indicating copy to clipboard operation
wren copied to clipboard

wren/language: Add unary `+` operator.

Open mhermier opened this issue 4 years ago • 6 comments
trafficstars

For the sake of completeness and to ease pretty formatting, allow numbers to be be prefixed with +.

mhermier avatar Apr 23 '21 10:04 mhermier

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.

PureFox48 avatar Apr 23 '21 10:04 PureFox48

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

mhermier avatar Apr 23 '21 10:04 mhermier

Yes, I see what you mean now.

I'd support the change.

PureFox48 avatar Apr 23 '21 10:04 PureFox48

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?

tr8dr avatar Jun 27 '23 09:06 tr8dr

Do the changes from the commit work @mhermier?

nikeedev avatar Jun 28 '23 09:06 nikeedev

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.

tr8dr avatar Jun 28 '23 10:06 tr8dr