Re: LIST "bug": .Remove on an empty list [message #73990 is a reply to message #73989] |
Tue, 14 December 2010 08:06   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
David Fanning wrote:
> I can't stop to look into this today (18 pages yesterday!!),
> but why can't you just write this ISEmpty method for yourself?
I have. But I believe it should be part of the standard library in IDL. A user shouldn't have to extend a class for such
basic functionality.
Philosophically, I'm a "just because you can extend a class doesn't mean you should" type of guy.
Pragmatically, I'm a "just extend the damn class!" fellow. :o)
> Function List::IsEmpty
> IF N_Elements(self) EQ 0 THEN RETURN, 0 ELSE RETURN, 1
> END
>
> That would work, que no?
Well, no. I would do something like
IF N_Elements(self) EQ 0 THEN RETURN, 1 ELSE RETURN, 0
:o)
Or, more likely:
Function List::IsEmpty
@boolean_codes
IF N_Elements(self) EQ 0 THEN RETURN, TRUE ELSE RETURN, FALSE
END
where "TRUE" and "FALSE" are defined (correctly :o) in the boolean_codes.pro include file.
cheers,
paulv
|
|
|