Re: Ruby doesn't implement x++ for Fixnum's because ???
by Tony Arcieri other posts by this author
Nov 8 2009 8:49AM messages near this date
Re: Ruby doesn't implement x++ for Fixnum's because ???
|
Re: Ruby doesn't implement x++ for Fixnum's because ???
On Fri, Nov 6, 2009 at 4:30 PM, Seebs <usenet-nospam@[...].net> wrote:
> "variables aren't objects"
I've seen this mentioned a few times. I think it's something of a gross
misstatement of a problem, and a deeper understanding might be able to peel
away some of the layers of the debate here.
I can't think of a language where "variables are objects". And this isn't
the issue. The real issue is Numeric values (i.e. "objects") are
immutable. Other types of objects, however, are mutable. "Everything is an
object", except some objects are different than others.
Advocates of allowing a ++ operator are suggesting that the operator have a
dispatch model which alters the local binding when applied to Numeric
types. I'm further suggesting it be dispatched like any other operator when
applied to non-numeric types.
What I really see happening here is that ++ reveals an otherwise
difficult-to-see difference in how immutable and mutable objects behave in
Ruby. There's no reason Ruby can't have ++, but it would need special case
behavior, because the behavior of Numerics is already a special case. Any
ugliness surrounding special-case behavior of ++ when implementing it
against Numerics stems from this inconsistency in Ruby itself, not the ++
operator.
It's not that I doubt the pragmatism of the immutability of Numeric values
(on the contrary, I'm developing a language where *all* values are
immutable), but this is really the cause of the problem, and the solution
(special casing how Numerics respond to ++ by providing alterations to the
local binding) causes me no qualms, as it's only a workaround of the
separation of immutable/mutable objects that's a fundamental part of Ruby to
begin with.
--
Tony Arcieri
Medioh/Nagravision
Thread:
RichardOnRails
Gavin Sinclair
Marnen Laibow-Koser
Tony Arcieri
David A. Black
T3ch.Dude
TonyMc
Tony Arcieri
James Edward Gray II
Seebs
Aldric Giacomoni
Sebastian Hungerecker
Aldric Giacomoni
Seebs
Seebs
Joshua Ballanco
Michael W. Ryder
Seebs
Rick DeNatale
Marnen Laibow-Koser
Aldric Giacomoni
Marnen Laibow-Koser
Aldric Giacomoni
Rick DeNatale
Aldric Giacomoni
Rick DeNatale
Aldric Giacomoni
Rick DeNatale
David A. Black
Aldric Giacomoni
Marnen Laibow-Koser
Marnen Laibow-Koser
Seebs
Seebs
Seebs
Gavin Sinclair
Tony Arcieri
Joel VanderWerf
Tony Arcieri
Marnen Laibow-Koser
Aldric Giacomoni
Tony Arcieri
Aldric Giacomoni
Phrogz
Ralph Shnelvar
Tony Arcieri
Tony Arcieri
Marnen Laibow-Koser
Tony Arcieri
Marnen Laibow-Koser
Tony Arcieri
Joshua Ballanco
Tony Arcieri
Seebs
Tony Arcieri
Seebs
Tony Arcieri
Tony Arcieri
Seebs
Seebs
RichardOnRails
David A. Black
Marnen Laibow-Koser
Seebs
Tony Arcieri
Rick DeNatale
Tony Arcieri
Rick DeNatale
Tony Arcieri
Marnen Laibow-Koser
Tony Arcieri
Walton Hoops
Tony Arcieri
Walton Hoops
Tony Arcieri
Florian Assmann
Marnen Laibow-Koser
Walton Hoops
Seebs
David A. Black
Gavin Sinclair
Gavin Sinclair
Gavin Sinclair
Tony Arcieri
David A. Black
Tony Arcieri
David A. Black
Yukihiro Matsumoto
Seebs
RichardOnRails
RichardOnRails
Martin DeMello
Aldric Giacomoni
Seebs
RichardOnRails
RichardOnRails
David A. Black
Seebs
Rick DeNatale
Seebs
Seebs
Lith
Gavin Sinclair
Tony Arcieri
Walton Hoops
Michael W. Ryder
Walton Hoops
Michael W. Ryder
Marnen Laibow-Koser
Walton Hoops
Michael W. Ryder
Walton Hoops
Matthew K. Williams
Marnen Laibow-Koser
Michael W. Ryder
David A. Black
David A. Black
Michael W. Ryder
Marnen Laibow-Koser
Tony Arcieri
Marnen Laibow-Koser
Tony Arcieri
David A. Black
Aldric Giacomoni
Martin DeMello
Tony Arcieri
Tony Arcieri
Martin DeMello
Paul Smith
Tony Arcieri
Seebs
Rick DeNatale
|