Re: [Vala] Suggestion: first {} and last {} operators in iteration-loops



On Fri, 2007-09-07 at 11:51 +0200, Raphael Bosshard wrote:
a few days ago I sent this suggestion to Jürg. Since I got no answer
yet, I feel free to send it here. ;)  Of course I think it's a good
idea, but I you think that I've been smoking pot, just tell me so. :D

Sorry about that, I've just sent you a response this moment, copied here
to have it on the list.

Have you ever considered first{} and last{} constructs for Vala?

I noticed that in a lot of cases when iterating over lists, the first
and the last element of such lists get special treatment. In c, you
usualy identify those elements manualy. And while its certainly possible to
use the same methods in Vala (or Java, or C#), it does strike me as
very clumsy and somewhat wrong.

Because of that I'd like to suggest first{} and last{} operators for
iteration loops:

Thanks for your suggestion. Special treatment for the first and/or the
last element is certainly used quite often, however I'm not sure that
first{} and last{} would fit in well enough into the syntax. I also
don't know of other programming languages providing something similar,
so it might actually be more confusing than helping like that. Maybe
there is another way to assist when you need to treat the first and/or
the last element in an iteration specially.

Jürg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]