Extended Type Design: further examples

jovo jovo at at.home
Tue Mar 20 06:19:28 PDT 2007


jovo Wrote:

> Derek Parnell Wrote:
> > 
> >   const char[] s;    // ok
> >   ...
> >   s[0] = 'a'; // fails
> >   s    = "new data"; //ok
> >   s.length = 2; // ok
> > 
> 
> No, it can not.
>  
> const int[] a = [1, 2, 3, 4]; 
> a.length = 2; // ok?
> some_var = a[3]; // oops!
>  

Ooops! :)
May be it's more logical then I was thinking.

There are will be always tension between consistency,
convenience and efficiency of generated code.
Actually I like general D's approach.

jovo





More information about the Digitalmars-d mailing list