My Issues with Slices and AAs

Jesse Phillips jessekphillips+D at gmail.com
Fri Mar 2 06:03:59 PST 2012


On Friday, 2 March 2012 at 13:33:17 UTC, Kevin Cox wrote:
> After learning and using D for a little while I have discovered 
> some (in my
> opinion) problems with the slices and associative array 
> built-ins (for now
> I will just say slice).  The main issue I have is that there is 
> no way to
> pass around something that looks like and acts like a slice.  
> This is
> because there is no class or interface to which slices adhere.  
> I think
> this is a very simple concept and it could be easily remedied 
> by creating
> an Array interface which slices implement.  This way you could 
> create
> things like lazy and asynchronously filled arrays.
> [...]
> In, conclusion. (Tl:Dr) slices and AAs do not allow 
> polymorphism and
> therefore are decreasing the power and flexibility of D.
>
> I hope to hear your opinions,
> Kevin.

D is not purely object oriented and must provide primitives the 
meet or exceed C.

The style for D code also tends to templates and meta 
programming. Ranges[1] fit nicely to this and the idea of slicing.

1. http://dlang.org/phobos/std_range.html

hmm bed time, no time for long explanations.


More information about the Digitalmars-d mailing list