const?? When and why? This is ugly!

bearophile bearophileHUGS at lycos.com
Mon Mar 2 10:08:50 PST 2009


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 :-)

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.

Bye,
bearophile



More information about the Digitalmars-d mailing list