Article on programming language adoption (x-post from /r/programming)

Ali Çehreli acehreli at yahoo.com
Thu Aug 1 11:55:19 PDT 2013


On 08/01/2013 08:01 AM, Tofu Ninja wrote:

 > Simple example, why would I want to type "node->next" when I could just
 > type "node.next".

However, that distinction allows accessing members of the pointer versus 
the members of the pointee. (Imagine 'node' is a type that overloads 
operator-> like smart pointers do.)

On the other hand, D's reference semantics make the distinction 
disappear for classes. But then there is the inconvenience of not being 
able to access the class variable versus the class object at least for 
some operations:

   auto o = new MyClass();

While almost everything else that is accessed by the dot operator is 
applied to the object, o.sizeof is applied to the variable. One thing to 
keep in mind...

Ali



More information about the Digitalmars-d mailing list