Reddit: why aren't people using D?
Walter Bright
newshound1 at digitalmars.com
Fri Jul 24 11:45:14 PDT 2009
Rainer Deyke wrote:
> 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.
From a user's point of view, an immutable reference is
indistinguishable from a value.
> 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.
True.
And in C++ with assignment overloads and copy constructors, one also has
no clue what a.x=5 does without looking at the source to those functions.
I don't think there's anyway we can pretend to know what semantics a
type has in a language with user-definable types without at least
looking at its declaration.
More information about the Digitalmars-d
mailing list