Why can't we define re-assignable const reference variable?

Christopher Wright dhasenan at gmail.com
Sun Feb 17 08:52:22 PST 2008


Robert Fraser wrote:
> Janice Caron Wrote:
> 
>> On 16/02/2008, Christopher Wright <dhasenan at gmail.com> wrote:
>>> generic programming != type system
>> I can't argue with that! :-) Perhaps I should have said, it will break
>> /either/ generic programming /or/ the type system. I suppose I was
>> thinking that if you have new syntax, and you want to keep generic
>> programming, then somehow you must force the new syntax to work for
>> all types, and /that/ breaks the type system, but I guess I was
>> probably thinking too far ahead there. :-)
> 
> D already has types that break generic programming. Static arrays, anyone?

Oh dear GOD yes. I'm doing an assertions library right now (cooked it up 
over the past couple days because I got tired of writing assert 
(something, "salient description here")) and strings are absolutely 
KILLING me.

I want to support Tango collections for list constraints, but I can't 
instantiate it with a static array. I can write some ugly templates to 
make it go away, but it's just really annoying.

And then I think sameAs constraints won't work right.

If strings were dynamic arrays, all my troubles would disappear.



More information about the Digitalmars-d mailing list