foreach, an analogy
Bill Baxter
dnewsgroup at billbaxter.com
Thu Oct 19 00:40:57 PDT 2006
John Reimer wrote:
> On Wed, 18 Oct 2006 20:43:13 -0700, Bill Baxter
> <dnewsgroup at billbaxter.com> wrote:
>
>> Gregor Richards wrote:
>>> Bill Baxter wrote:
>>
>>> The bigger door is 'for'. 'foreach' is nothing but a convenient
>>> wrapper around 'for'. And don't you OOphiles go telling me that your
>>> fancy class foo that has iteration /needs/ 'foreach':
>>> for (auto bar = foo.begin(); !(bar is null); bar = foo.iterate(bar))
>>> Is it less pretty than foreach? Yeah. That's why foreach exists.
>>
>> :-) Heh heh.
>>
>>> But don't go saying that the reverse foreach is a band-aid patch,
>>> because
>>> both forms are just convenience wrappers around the far more powerful
>>> and useful 'for'.
>>
>> Yeh, for is like a piece of wood. You can do anything with it.
>> Including make a door. But sometimes its better just to have the door
>> pre-made.
>>
>>> Your small door is actually the screen door.
>>
>> Lots of little holes? Maybe. But screen doors have their uses too.
>> Much better for the summertime to help make the livin' easy. ;-)
>>
>> --bb
>
>
> Don't screen doors keep the bugs out? ;)
>
LOL! Yes, they do! ;-)
--bb
More information about the Digitalmars-d-announce
mailing list