Questions about the slice operator

Jonathan M Davis jmdavisProg at gmx.com
Tue Apr 3 20:09:35 PDT 2012


On Wednesday, April 04, 2012 04:45:43 ixid wrote:
> "And what would it mean in the case of parallel(0 ..5)?"
> 
> Wouldn't it be a more elegant way of doing pretty much the same
> thing as parallel(iota(0,5))? Iterating over a range and carrying
> out your parallel task with that value.

1. ".." would then be doing something very different than it does in all other 
cases.

2. That's moving something into the language which works perfectly well in the 
library, and moving it into the library doesn't really buy us anything.

3. The trend is to move stuff _out_ of the language and into libraries rather 
than into the language. The overall take on it at this point (especially from 
Andrei) is that if it _can_ be done in a library, then it _should_ be done in 
the library. The language is already very powerful and is arguably overly 
complex already. So, the question at this point is very much why it should be 
in the language when it works in the library and _not_ why it's in the library 
when it could be in the language.

I can understand why you'd like to use ".." in more cases than is currently 
allowed, but given the current semantics of "..", it really wouldn't make 
sense to use it in the sort of cases that you'd like to. Even if they're 
conceptually similar, they're semantically _very_ different from the current 
use cases for "..". So, using ".." in place of iota really wouldn't be making 
the language more consistent, even if it might seem so at first glance.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list