A better language

Chris Nicholson-Sauls ibisbasenji at gmail.com
Mon Apr 17 22:22:05 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?

Honestly, to my eyes?  The current style.  I don't care for the `->` symbol needed in the 
proposed syntax, and I'm just too used (in D) to scanning down columns of variables and 
glancing (right to left) to check types.  Probably if it had been otherwise from earlier 
on, my habits would be different, while as it is...  Although I do admit to liking a 
left-to-right style in general, I just don't see a way to do it in D.  For what its worth, 
a purely hypothetical pet language of me and a couple buddies (codename Lux) has used this 
for years:

# {* Equivelant to D decleration "int[10]* x;" *}
# var() {
#   &[10]int32 : x ;
# }

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list