[Issue 9437] unwanted behavior from phobos range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 1 07:36:27 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9437



--- Comment #5 from monarchdodra at gmail.com 2013-02-01 07:36:26 PST ---
(In reply to comment #4)
> i do not talk to modify a range while is in a loop but access to const method
> should be possible.
> <type> name() const { ... }
> 
> what is silently ?
> 
> 
>     R r = R( "Hello D users" );
>     foreach( l; r )
>         writeln( l, ", ", r.front() );
> 
> you have 2 variable r and are not the same for me is dangerous. I know now what
> happen.
> But when you look this code it seem ok but is not.

But that's the point, in that code, both "r" ARE the same variable. r is r. It
is the *iteration* that is done on an un-named copy.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list