Stupid little iota of an idea
%u
e at ee.com
Wed Feb 9 04:06:50 PST 2011
== Quote from bearophile (bearophileHUGS at lycos.com)'s article
> %u:
> > can you maybe explain what it exactly means?
> > And, also how it relates to your enhancement?
> In programming languages it means features that have fully separated purposes,
that can be combined together in clean and safe ways to create more complex
functionalities. Combining in "clean and safe ways" means they don't have unwanted
interactions, their lower level nature is sufficiently encapsulated and doesn't
leak out too much, so their sub-systems are mostly sealed, if you want to see it
with systems theory ideas.
> In the current discussion foreach(i;iota(5)) and foreach(i;0..5) are usable for
the same purpose, so those two "features" don't have fully separated purposes. On
the other hand you can't use 0..5 where you want a lazy range:
> auto r = 0 .. 5;
> You need to us iota:
> auto r = iota(0, 5);
> So the 0..5 can't be combined to many other language functionalities to produce
something bigger.
> This is why several people have asked for a more orthogonal interval syntax in D.
> Bye,
> bearophile
Thanks!!
int[3] arr = [0..5:2];
More information about the Digitalmars-d
mailing list