Re: Warning error

new topic     » goto parent     » topic index » view thread      » older message » newer message

don cole wrote:
> }}}
<eucode>
> sequence pastaTops  pastaTops={}
> </eucode>
{{{

> I do not get, "Warning the sequence pastaTops is not used".

Yes, that once struck me too. Strictly speaking, you are correct in the sense
that it is not "used", but I think that particular warning applies much more to
routine parameters, where you wouldn't expect explicit assignment.

However, there is a HUGE bulk of legacy code which does exactly this (eg VOID in
win32lib) and you could even end up with eg (untested):
function pwr(atom base, integer raise)
-- returns base^^raise, eg pwr(5,3)=125
atom pwr
   pwr=1
   for i=1 to raise do
     pwr*=base
   end for
   return pwr
end function

Technically, the i in "for i" is "not used". OK, now I've typed it (;-((), I
guess it is "used" by the end for, but you ought to get the point that strict
enforcement would likely trigger far more scares than help any. Sorry for the
duff example, trying too hard to be different from win32lib's "VOID" I guess.

Bad example aside, I guess if we ever get (agreement on) an elegant method to
ignore return values then this will suddenly become much more pertinent.

Regards,
Pete
PS I vote for {}=xxx(), btw, very Eu-like, as I read it as "nothing becomes
equal to the result of xxx()" or I suppose if you prefer, "store the result of
xxx() in nothing/nowhere". Whereas I never really liked the ~xxx() idea.
Plus it ties up nicely with my plans for multiple assignment, and also I always
found "{}=" dead easy to type, actually easier/faster than "~" even thought it is
three keys(I regularly use) not one(I rarely use).

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu