[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do I really need to use loops on objects?

philaldis@yahoo.com wrote:

> I don't think that this isn't particularly consistent with the IDL
> philsophy. I can see what you're saying but how would go about
> implementing your suggestion being as in your case the objects may be
> all of the same type, but in other cases the objects may all be
> different. What would IDL do then when some of the objects do have the
> method called and others don't?

In the case where an object in an array didn't have the required method,
IDL could spit out an error to the effect of:
%Attempt to call undefined method: 'OBJECT::METHOD'   when a method was
called on a whole array. It would be up to the programmer to make sure the
array was filled with the appropriate class of objects.
At any rate, I still have to make sure all the objects in my array have the
required method when I use a for loop on an object array!

> What is more consistent with IDL philosophy is the fact that a
> procedure like Obj_Destroy() can work on an entire array of object
> references so you can destroy a whole bunch of them in one go. However
> IDL does not continue with this fully. What's always riled me is the
> fact that Obj_Class() does not work on a objArr and you can't get it to
> return a string array with the object's classes.

I'll agree with that.

> I'm sure lots of people will disagree but I think on this occaison IDL
> is correct.

Well, I guess I am a disagree-er. The fact that after learning the basics
of IDL I would intuitively try to use object arrays in the same style that
I use all the other array types, suggests to me that there is an
inconsistency. Of course I have the same gripe about pointer arrays, but
then I'm used to programming in C, where I am allowed to crash the computer
in all sorts of creative ways by mis-casting variables.

Thanks for the opinion,

Brad Gom