A better language
David Medlock
noone at nowhere.com
Mon Apr 17 17:35:47 PDT 2006
renox wrote:
> Chris Nicholson-Sauls wrote:
> [cut interesting remark showing that automagic pointer dereferencing
> reduce the interest of postfix pointer derefencing]
>> // your idea: x: @[10]->int;
>> // currently: int[10]* x;
>>
>> Knowing that in D types are read right-to-left in declarations,
>
> I know that and for me, this is an unpleasant pitfall of D, especially
> for array declaration:
> int[Y][X] t; and then t[x][y] = ...
>
> t: [X]->[Y]->int; and then t[x][y] = ...
>
> Honnestly which reads better?
>
I would say wrap your array for the specific problem you are trying to
solve, then override the opIndex/opIndexAssign methods:
t[ X, Y ] = ....
Reads much better.
-DavidM
More information about the Digitalmars-d
mailing list