[nem-en] incorrect side effect of ++ operator
Radek Jedrasiak
radek at jedrasiak.at
Mon Sep 27 17:39:13 CEST 2004
> -----Original Message-----
> From: devel-en-bounces at nemerle.org
> [mailto:devel-en-bounces at nemerle.org]On Behalf Of Kamil Skalski
> Sent: Montag, 27. September 2004 14:33
> To: devel-en at nemerle.org
> Subject: Re: [nem-en] incorrect side effect of ++ operator
>
>
> Dnia poniedziałek, 27 września 2004 14:18, Wiktor Zychla napisał:
> > the side effect of the ++ operator is, in my opinion, incorrecly used in
> > following scenario.
>
> ++i ~ ( i = i + 1 ) : void
>
> Probably you are right, that this is conterintuitive for C
> programmer. I also
> liked the semantics of tab [i++] = 5;
>
> But in functional language it is better to keep assignments
> having type void.
>
[snip]
>
> Just do
> ++i;
> Console.WriteLine( "{0}", i );
How about a macro replacing the ++ prefix operator and ++ postfix operator
with the coresponding blocks? That way the return types of assignments
could be left to be void and there would still be less trouble with
all the people who got used to the way i++ and ++i work (don't forget about -- ;-)
just my 2 EuroCents
Cheerio
radek
More information about the devel-en
mailing list