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

Home » Public Forums » archive » Does this make sense? (scalar objects)
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: Does this make sense? (scalar objects) [message #37255 is a reply to message #37183] Fri, 05 December 2003 01:52 Go to previous messageGo to previous message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
JD Smith wrote:
> On Wed, 03 Dec 2003 07:33:20 -0700, Marc Schellens wrote:
>
>
>> check this out:
>>
>> file tt.pro:
>> pro o::test
>>
>> help,self[[0]]
>> help,(self[[0]])
>>
>> print,self[[0]].a
>> print,(self[[0]]).a ;; ???
>> end
>>
>> pro tt
>>
>> s={o,a:0}
>>
>> print,s[[0]].a
>> print,(s[[0]]).a
>>
>> obj=obj_new('o')
>>
>> obj->test
>> end
>>
>>
>> IDL> tt
>> % Compiled module: TT.
>> 0
>> 0
>> <Expression> OBJREF = Array[1]
>> <Expression> OBJREF = Array[1]
>> 0
>> % Object reference must be scalar in this context: <OBJREF Array[1]>
>> % Execution halted at: O::TEST 7 /home/marc/idl/tt.pro %
>> TT 19 /home/marc/idl/tt.pro %
>> $MAIN$
>>
>>
>> Doesn't make sense, does it?
>
>
> Well, given that self is always a scalar, your attempts to index it are
> confusing. In any case, the notation a[[b]] creates a single element
> vector:
>
> IDL> a=1
> IDL> print,size(a[[0]],/DIMENSIONS)
> 1
>
> You cannot do anything to more than one object at a time (e.g. no objarr
> method calls or instance variable dereference). Hence the error. The
> reason why self[[0]].a works, is that there is probably special code to
> handle instance variable derefence for a single element vector, which
> does not or cannot operate with (self[[0]]).a. Method calls don't like
> a vector no matter what: try
>
> obj[[0]]->test
>
> Confusing issues like this have lead at least one RSI programmer to long
> for the abolishment of the scalar as a separate type from a single
> element vector. Sadly, the chance to do this without breaking lots of
> code has long passed.


I cannot guess any example about which (IDL) code would be broken,
if single element vectors and scalars would be treated the same.
Do you have an example?
Or did you mean binary code linked to IDL?

marc
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Error when running ICONTOUR
Next Topic: Re: ActiveContours

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

Current Time: Wed Oct 08 15:48:47 PDT 2025

Total time taken to generate the page: 0.00447 seconds