On Thu, 20 Feb 2014 17:09:31 -0000, Steven Schveighoffer <schvei...@yahoo.com> wrote:

On Thu, 20 Feb 2014 11:07:32 -0500, Regan Heath <re...@netmail.co.nz> wrote:

Only if the compiler prefers opApply to range methods, does it?

It should. If it doesn't, that is a bug.

The sole purpose of opApply is to interact with foreach. If it is masked out, then there is no point for having opApply.

Thanks.

So, if we had this support which I am asking for:

        foreach(index, value; range) { }

And, if someone adds opApply to that range, with a different type for the first variable then an existing foreach (using index, value) is likely to stop compiling due to type problems.

This seems acceptable to me.

There is an outside chance it might keep on compiling, like if 'i' is not used in a strongly typed way, i.e. passed to a writefln or similar. In this case we have silently changed behaviour.

Is this acceptable?

R

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

Reply via email to