foreach with a default range

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 11 14:21:18 PDT 2015


On 6/11/15 5:06 PM, Jonathan M Davis wrote:
> On Thursday, 11 June 2015 at 20:54:46 UTC, Steven Schveighoffer wrote:
>> It makes sense, and is very extendable, and uniform. You can deal with
>> this much easier when imlplementing some sort of wrapping than one
>> that has to do something different depending on how many args are
>> passed inside the []. I like the new way.
>
> Well, considering that we're talking about a _slicing_ operation, and
> not an indexing operation, I'm not about to start using opIndex for it
> unless I'm forced to.

opIndex is used for slicing operations now. It's just the index is a 
range of indexes, not a single index.

I think opSlice probably should have been given a different name instead 
of commandeered for a new meaning. Like opIndexRange or something.

-Steve


More information about the Digitalmars-d mailing list