comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » majority voting
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: majority voting [message #65139 is a reply to message #65079] Fri, 13 February 2009 01:31 Go to previous messageGo to previous message
Allan Whiteford is currently offline  Allan Whiteford
Messages: 117
Registered: June 2006
Senior Member
F�LDY Lajos wrote:
>
> On Thu, 12 Feb 2009, JD Smith wrote:
>
>> I'm not sure if this is intentionally or accidentally inconsistent,
>> but it is indeed very useful.
>
>
> It may be useful, but I think X=X+1, X+=1 and X++ should give the same
> result for any X. Most programmers use these interchangeably.
>

Lajos, JD,

I think X+=1 should give the same as X++ (which they don't). In a
vectorised form of ++ (which most languages don't have) you're saying:
"here's a list of things, increment them all by one", it's reasonable to
assume that if the same thing is repeated then it will be acted on twice.

X=X+1 more means, in my mind, "evaluate X+1 and set X to the result of
that evaluation" - it's clearer in my mind that everything on the right
of the = will happen before the set operation is performed.

I do agree, of course, that this difference could lead to confusion.

The issue is that many languages like C explicitly don't allow you to
change the same variable twice on one operation. Languages like Perl
positively encourage it. I've never seen a general statement about what
IDL can and can't do in this regard. I could argue that "++x[[0,0,1]]"
doesn't really fall into this category since we're only using one operator.

IDL doesn't have a formal specification like C (the manual doesn't
count) nor has anyone ever said (at least that I've heard) that the
implementation is the specification (like, say, Perl 5).

I remember the awful day when the result of "help,({a:[1]}).a" changed
and all my widget based code collapsed in a heap - I live in fear of
that day coming again so share your worries. It's possible that someone
will look at ++ and think they can split it across multiple cores - that
will be a bad day.

Maybe someone should write to ITTVIS and ask if they intended this as a
feature and if they can guarantee that it will remain. I'll do this and
report back.

Thanks,

Allan

> regards,
> lajos
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Reading multiple ASCII files in as 2d arrays and putting them into a 3d array
Next Topic: Different issue

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:31:44 PDT 2025

Total time taken to generate the page: 0.00265 seconds