const sucks

John Reimer terminal.node at gmail.com
Sat Oct 18 14:24:00 PDT 2008


Hello Dave,

> I'd like to read more opinions on D3 "default immutapurity"... IIRC,
> even though it was considered a stretch for D2 it was actually
> discussed for a time, and (again IIRC) I don't think Walter was
> neccessarily the one who put the kabosh on that direction of thought.
> 
> If D3 doesn't try it first, someone might get "E" right in the
> meantime <g>. Anders seemed to intimate that "E" is a direction he's
> considering, and hasn't MS Research already been experimenting with
> something like this (not F#, but with another C#-based, primarily
> imperative language)? Someone posted a link a while back...
> 
> Anyway, it kind of seems a logical progression to me, especially
> considering this from:
> http://www.digitalmars.com/d/2.0/const-faq.html#const
> 


I have extremely limited experience with const, so my opinion bears very 
little weight on the matter... but, for what's its worth, I agree with Dave. 
 I think it would great to explore "immutability by default" regardless of 
the precedent set by original D and C++ (Hah! Throw caution to the wind!). 
 "Explore" being the key word: "after trying it for a bit, we might get used 
to it." :-D

I was just reading the link above too, and I notice that this would fix consistancy 
with "Why aren't function parameters const by default?"  I imagine that's 
already been brought up multiple times before, though.

Any chance that we might see an experimental version of this?  I'm surprised 
it hasn't been tried with D considering all the other attempts made with 
const already. 

Are there any other drawbacks with default immutability other than breaking 
with the norm?

-JJR





More information about the Digitalmars-d mailing list