More D newb questions.

Pontus Pihlgren pontus at update.uu.se
Fri May 9 03:04:02 PDT 2008


Me Here skrev:
> Pontus Pihlgren wrote:
> 
>> probably only meaningful in Perl   where
>> arrays really are linked lists.
> 
> Not quite. Perl's arrays are actually bog standard C style arrays (of pointers
> to SV*s).
> Plus a header and some logic: 
> 
> http://www.perl.org/tpc/1998/Perl_Language_and_Modules/Perl%20Illustrated/av.gif
> 
> The guts of an array is a contiguos allocation of size * 4 bytes. 
> Their power & flexibility comes completely from the syntax 
> and core code that implements it.
> Their relative efficiency comes from the use of two pointers,
> and length field and two flag bits in teh header.
> 
>> Regards,
>> Pontus.
> 
> Cheers, b.
> 

This was very interesting read:

http://www.perl.org/tpc/1998/Perl_Language_and_Modules/Perl%20Illustrated/

I should probably have read it years ago. Still though, I don't that 
kind of complexity should go into D, no matter how sugary syntax it 
gives you.

What do you think, would it be bad to make D slice syntax a bit more 
like Perl? That is, allowing you to mix indexes and slices, and having 
them both on the right- and lefthand side:

a[4, 2, 5..7] = b[1,3..6];

/P



More information about the Digitalmars-d mailing list