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

Home » Public Forums » archive » _overloadMinus: what to do with invalid input?
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: _overloadMinus: what to do with invalid input? [message #89932 is a reply to message #89931] Tue, 30 December 2014 06:58 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hello,

On 12/29/14 17:27, Paulo Penteado wrote:
> On Monday, December 29, 2014 5:41:49 PM UTC-2, Mike Galloy wrote:
>> I would think an error and halting, like IDL would do if you tried to use
>> an invalid operator with the native types. What happens if you try to add
>> two pointers? (not in front of my computer right now)
>
> To answer Mike's question:
>
> IDL> a=ptr_new(1)
> IDL> b=ptr_new(2)
> IDL> c=a+b
> % Operation illegal with pointer types.
> % Execution halted at: $MAIN$
>
> Regarding Paul's question, I would say that the answer depends on how
> one envisions the object's usage. If one decides it makes no sense to
> do the subtraction, like with pointers, it should throw an error. An
> error should also be raised, instead of returning a value, if such a
> return value could be confused with a valid result. For instance,
> taking IDL's list:
>
> IDL> l=list(1,2)
> IDL> l+3
> % LIST::_OVERLOADPLUS: Arguments must both be lists.
> % Execution halted at: $MAIN$

Oh. That make sense. I guess I should have tested using objects too,
rather than intrinsic types.

An error it is.

Thanks guys.

cheers,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: CGContour with and without cell_fill keyword
Next Topic: Create an array of color name

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

Current Time: Wed Oct 08 13:40:09 PDT 2025

Total time taken to generate the page: 0.00392 seconds