[nem-en] incorrect side effect of ++ operator

Kamil Skalski nazgul at nemerle.org
Mon Sep 27 16:55:10 CEST 2004


Dnia poniedziałek, 27 września 2004 16:38, Ricardo Fernández Pascual napisał:
> > > But in functional language it is better to keep assignments having type
> > > void.
>
> I totally agree with this. Assignments are actions, they should not be
> used inside expressions, it is confusing.

Exactly, if one wants action and value at the same time, then one can write
{ i = 4; i }

>
> > So it is to be reconsidered whether to make unused value warnings
> > optional. In fact this warning have never prevented me from making
> > any mistake.
>
> FWIW, I like the current behaviour and I think it should be the default.
> Most times, it may not be an error to ignore a result, but I think it is
> bad style.

Moreover, with the new syntactic sugar:
def builder = StringBuilder ();
_ = builder.Append ("aa");

is will even look quite clear and elegant, because 
ignore (builder.Append ("aa")) is long for typing and makes code a little bit 
fuzzier.

>
> > Another thing to reconsider is the if/when/unless issue, maybe there
> > should be just if. But I'm not sure about this one.
>
> I like the current situation about this too, it makes the language more
> simple and avoids ambiguity. However, it doesn't matter very much in
> practice, as seen in other languages.

Right, probably there are no sufficient reasons for when/unless syntax...

-- 
Kamil Skalski
http://nemerle.org developer




More information about the devel-en mailing list