From: Sebastian Hungerecker on
Am Donnerstag 19 November 2009 16:48:52 schrieb Aldric Giacomoni:
> http://jicksta.com/posts/superators-add-new-operators-to-ruby
> Well, with -that-, we definitely can add '++' as syntactic sugar for
> succ.

But what good would that do except confuse people?

If x++ were equivalent to x.succ neither x++; p x nor p(x++) would behave
as expected (were "as expected" means "like they do in other languages").

For x++ to behave as expected, it would have to be sugar for x.succ! (and
x.succ! would have to return x's previous value), which, as has been pointed
out, doesn't and can't exist.

From: Aldric Giacomoni on
Sebastian Hungerecker wrote:
> Am Donnerstag 19 November 2009 16:48:52 schrieb Aldric Giacomoni:
>> http://jicksta.com/posts/superators-add-new-operators-to-ruby
>> Well, with -that-, we definitely can add '++' as syntactic sugar for
>> succ.
>
> But what good would that do except confuse people?
>
> If x++ were equivalent to x.succ neither x++; p x nor p(x++) would
> behave
> as expected (were "as expected" means "like they do in other
> languages").
>
> For x++ to behave as expected, it would have to be sugar for x.succ!
> (and
> x.succ! would have to return x's previous value), which, as has been
> pointed
> out, doesn't and can't exist.

Hey. You see that horse on the ground? It's dead. Dead dead dead. D-E-D,
dead. I was just making a joke :)
--
Posted via http://www.ruby-forum.com/.