Using map instead of iteration

Jonathan M Davis jmdavisProg at gmx.com
Sun Mar 6 17:41:40 PST 2011


On Sunday 06 March 2011 17:20:33 bearophile wrote:
> Jonathan M Davis:
> > I'm sure that part of the problem is the fact that a .. b is also used in
> > slicing, where it does not mean the same thing
> 
> It means the same thing, with a interval literal.
> 
> > - that and iota works just fine,
> 
> Currently it has a design bug that I've underlined.
> 
> > and increasingly, Andrei and Walter seem to prefer having stuff in the
> > library rather than the language itself when there's no significant gain
> > to be had by putting it in the language.
> 
> The gain is simplifying the language, removing the special cased syntax of
> foreach and switch and opSlice, and more, and replacing them with
> something more general, more polished and generic, that allows more usages
> and more runtime efficiency. This makes D look less like a pile of special
> cases and more like a designed language. So you are quite off-mark.
> 
> See my recent answer:
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&a
> rticle_id=131378

If anything, I'd argue to simply remove .. from foreach and have iota be the way 
to do it. The only other inconsistency is with case statements, but making them 
have an open right end would likely be problematic (not to mention break tons of 
code), whereas an open right end is exactly what it should be in the general 
case. I really don't see the problem other than the fact that using .. in 
foreach is completely redundant at this point, since we have iota.

- Jonathan M Davis


More information about the Digitalmars-d mailing list