>Following Python Zen, I don't like to have two different syntaxes to do the 
>same thing, [...]<

That was not clear enough, second try:


a[] = b[];  static  dynamic
static      OK1     OK1
dynamic     OK1     OK1

a = b[];    static  dynamic
static      Err     Err
dynamic     Err     Err

a[] = b;    static  dynamic
static      Err     Err
dynamic     Err     Err

a = b;      static  dynamic
static      Err2    Err
dynamic     Err     OK2

int i; a=i; static  dynamic
            Err     Err

int i;
a[] = i;    static  dynamic
            OK3     OK3

Key:
  Err =  Syntax error
  OK1 =  Copies all items from an array to the oter.
  OK2 =  Copies just the stuct of the dynamic array, array body not copied.
  OK3 =  Copies the value to all the items of the array.
  Err2 = Syntax error, becase there is no reference to copy, better keep 
language tidy.


You can see I have disallowed this too:
int a, b;
a = b;

This breaks generic code, but Andrei said that it's bad when the same syntax 
can be O(1) (because the same done on dynamic arrays is a O(1)) or O(n). And 
the semantics is too much different.

You are free to disagree. The good thing is that now I have those matrices of 
all cases, so it's easy to see and design :-)
The final version of those matrices can be added to this page:
http://www.digitalmars.com/d/2.0/arrays.html

Bye,
bearophile

Reply via email to