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

Home » Public Forums » archive » Would you consider this a bug?
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: Would you consider this a bug? [message #13067 is a reply to message #12982] Thu, 01 October 1998 00:00 Go to previous messageGo to previous message
David Kastrup is currently offline  David Kastrup
Messages: 33
Registered: February 1998
Member
Kevin Ivory <Kevin.Ivory@linmpi.mpg.de> writes:

> David Kastrup wrote:
>> a=[3,4,5]
>> a[[2,1,0]] = a
>>
>> a will be set to [3,4,3]
>>
>> Would you think this a bug?
>
> I think this is extremely dangerous programming: you might get
> undefined or unpredictable results with almost any programming language
> in this type of case.

Disagree. IDL is WRT to assignment a value oriented language, so one
might expect first the right side to be evaluated and then the left
side to be assigned (unless IDL can do this more efficiently without
affecting the result).

If I really wanted a to be destroyed during the operation, I could
have written
a[[2,1,0]] = temporary(a)

> The clean way of doing what you want is to
> index the right side of the expression:
> a = a[[2,1,0]]

Unfortunately, translating something like

a[[5,2,3,0,4,1]] = a
into the equivalent
a = a[[3,5,1,2,4,0]]
is not easy to do in the general case. In my particular case, I had
some data that needed to be processed in sorted order, the results
needed to be rearranged in original order.

Something like
s = sort(a)
a = a[s]
process(a)
a[s] = a

--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f�r Neuroinformatik, Universit�tsstr. 150, 44780 Bochum, Germany
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: CENTERING TEXT
Next Topic: what am I doing wrong?

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

Current Time: Sun Oct 12 06:27:48 PDT 2025

Total time taken to generate the page: 0.32117 seconds