Proposal: Hide the int in opApply from the user
Bruce Adams
tortoise_74 at yeah.who.co.uk
Mon Jan 7 14:51:38 PST 2008
On Mon, 07 Jan 2008 09:06:52 -0000, Bill Baxter
<dnewsgroup at billbaxter.com> wrote:
> I proposed this iniitally over in D.learn, but I'm cleaning it up and
> reposting here in hopes of getting some response from Walter who was
> probably too busy finishing const and eating holiday Turkey at the time
> to notice. And rightly so.
>
> I don't believe it's appropriate in a high-level supposedly clean
> language like D that one of the main facilities for iterating over user
> types (foreach) requires writing code that passes around magic values
> generated by the compiler (opApply).
>
> It seems wrong to me that these magic values
> - come from code generated by the compiler,
> - must be handled exactly the proper way by the user's opApply
> (or else you get undefined behavior, but no compiler errors)
> - and then are handed back to code also generated by the compiler.
>
When you say magic value what do you mean? From the context it sounds like
you
are describing an iterator without iterators being properly part of the D
world (yet).
More information about the Digitalmars-d
mailing list