Re: [Feature Request] "first:" "last:" sections in a "foreach" block
From: Joep (Staat_at_DeStoep.nl)
Date: 04/05/04
- Next message: Tim Jarvis: "Re: Delphi vs C#"
- Previous message: Tim Jarvis: "Re: Delphi vs C#"
- In reply to: Jon Skeet [C# MVP]: "Re: [Feature Request] "first:" "last:" sections in a "foreach" block"
- Next in thread: Daniel O'Connell [C# MVP]: "Re: [Feature Request] "first:" "last:" sections in a "foreach" block"
- Reply: Daniel O'Connell [C# MVP]: "Re: [Feature Request] "first:" "last:" sections in a "foreach" block"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 6 Apr 2004 00:06:21 +0200
IMHO
foreach means foreach means foreach, so for each item of a collection of
items do this. I would not like to see a switch inside the loop that test
for the first or the last or whichever item. It conflicts with what I
learned long time ago about loop-unrolling and its effect.
Instead, I would like to state foreach item in this (not that) collection do
this, this collection excluding the first and last item for example, in
other words, I would like to be able to more precisely define the items for
which I want some code to execute. It could be that I want to execute this
for every other item and that for all the others.
What about something along these lines where I would be able to define a
part of the collection of items? A bit like string.substring and similar
constructs.
foreach(item in items[2,8])
or
foreach(item in items[2,])
or like the Python splice thingy?
The suggestion I like, meaning a way to more precisely define which items to
execute code for. Syntax and semantics are another thing.
Can't this be done already I wonder...
- Next message: Tim Jarvis: "Re: Delphi vs C#"
- Previous message: Tim Jarvis: "Re: Delphi vs C#"
- In reply to: Jon Skeet [C# MVP]: "Re: [Feature Request] "first:" "last:" sections in a "foreach" block"
- Next in thread: Daniel O'Connell [C# MVP]: "Re: [Feature Request] "first:" "last:" sections in a "foreach" block"
- Reply: Daniel O'Connell [C# MVP]: "Re: [Feature Request] "first:" "last:" sections in a "foreach" block"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|