More D newb questions.

Pontus Pihlgren pontus at update.uu.se
Tue May 6 04:56:33 PDT 2008


<snippety>

> (**Shame about the need to repeat the abcd[ ] bit so much. Perl#s array slices
> accept multiple individual indexes (as well as ranges). So the equivalent of
> the above would be:
> 
> 	@table[ ... ] = @abcd[ b1, b2, b3, b4, b5, b5, b7, n8 ];
> 
> which is a lot nicer to read. )
> 

Perls array slice syntax is quite awsome and powerful, but I'm not sure 
what implications they would have in D, probably only meaningful in Perl 
  where arrays really are linked lists.

Another concept from Perl that would have solved the original problem is 
list context versus scalar context. That is, when a list is expected 
things become a list. If it existed in D, then ~ would introduce a list 
context and abcd[b1] would be interpreted as a slice.

Not sure I would like to see either feature in D.

Regards,
Pontus.



More information about the Digitalmars-d mailing list