Reddit: why aren't people using D?

Leandro Lucarella llucax at gmail.com
Fri Jul 24 12:40:04 PDT 2009


Rainer Deyke, el 24 de julio a las 11:55 me escribiste:
> Leandro Lucarella wrote:
> > !? It's true that in Python all are references, but there are inmutable
> > objects in Python, like int, float, strings and tuples. From a practical
> > POV it exactly the same as value types, if you do:
> 
> Immutable reference types are still reference types, and follow the same
> rules as other reference types.  You just can't modify them.  The
> assignment operator *always* rebinds a reference, regardless of the
> mutability or immutability of any objects involved.

That's true, conceptually, but when you use the variables, you use them as
value types, with the same advantages and limitations.

> The one exception is that operators like '+=' will create a new object
> when applied to immutable types, but modify existing objects when
> applied to mutable objects.  And, yes, this bothers me in Python.  A lot.

How do you note that? Really. Python inmutables have value semantics.

> But that's still not half as bad as D, where something simple like 'a =
> b; a.x = 5;' can have two completely different meanings depending on
> whether 'a' is a reference type or a value type.

Yes, that's true, but this is a common problem. Think of operator
overloading... Even in Python that could mean *anything* (__getattr__).

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Y será el día en que la electricidad deje de ser rayo y sea depilador
femenino.
	-- Ricardo Vaporeso



More information about the Digitalmars-d mailing list