My Issues with Slices and AAs

Ali Çehreli acehreli at yahoo.com
Fri Mar 2 06:40:41 PST 2012


On 03/02/2012 06:03 AM, Jesse Phillips wrote:
 > 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.

inputRangeObject() and outputRangeObject() functions return polymorphic 
interfaces in the form of InputRangeObject and OutputRangeObject.

 >>
 >> 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.

A shameless plug of a tutorial of mine:

   http://ddili.org/ders/d.en/ranges.html

That includes the following link to Andrei's paper:

   http://www.informit.com/articles/printerfriendly.aspx?p=1407357

Ali


More information about the Digitalmars-d mailing list