const?? When and why? This is ugly!

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Mar 2 10:22:38 PST 2009


bearophile wrote:
> Andrei Alexandrescu:
>> Not all shared data is immutable. Data marked as "shared" is
>> shared. The cool thing is that D switches the default to the
>> "right" default.
>> 
>> The style of programming in which you create a new thread that
>> joyously sees and can modify *all* of the memory space available to
>> every other thread will go the way of the dinosaur. It's just not
>> tenable anymore, and I predict today's mainstream programming
>> languages abiding to that model are facing major troubles in the
>> near future.
> 
> I agree.
> 
> Also, take a look at Clojure, one of the very few languages designed
> to manage multi-core CPUs. In Clojure you can use mutable data and
> data structures, but the default is immutable data. They argue that's
> the "right" default if you want to program for multi-core CPUs. If
> this and the Clojure experiment turn out as true/right, D2/D3 may
> have to change more :-)

Or Clojure. (I'm not even kidding. D has a very compelling computation 
model that beats the pants off traditional functional approaches.)

The thing is, in a few short years "if you want to program for 
multi-core CPUs" will sound as funny as "if you want to program for CPUs 
with more than 16-bit addressing" sounds today. Yet it was a valid 
qualification to add in the past, when 32- and 64-bit systems were a rarity.

> In the close future D std lib may enjoy to grow several immutable
> data structures (finger trees, etc), even if the D2 language &
> community on the whole has not embraced the immutability much yet.
> Such data structures and other features in the std lib can't hurt.
> We'll surely talk more about this topic.

Looking forward to your contributions to Phobos. Just drop 
pass-by-delegate like a bad habit. :o)


Andrei



More information about the Digitalmars-d mailing list