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

Home » Public Forums » archive » Why are objects global?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Why are objects global? [message #20699] Tue, 18 July 2000 00:00
bjackel is currently offline  bjackel
Messages: 10
Registered: September 1993
Junior Member
Subject line says it all.

I've been playing with objects (not object graphics) for a
while now, and can see how they might be useful. However,
having to call "obj_destroy" manually at the end of functions
and routines has been the source of many headaches.

For example, consider the procedure below. It creates
a "vector3" object which is used for various useful
calculations, but is of no further use outside "example".
Once we exit "example", variables "a" and "b" are automatically
cleaned up. However, "c" gets leaked, unless we explicitly
destroy it.

Previously, variables in routines would be local unless
1) linked to a parameter or keyword
2) placed in a common block
3) attached to a pointer

Why must objects be any different?

I would argue that they should be treated the same as
any other variables: cleaned up at the end of a procedure
or function, unless one of the three conditions mentioned
above is met. The current behaviour adds complexity to
IDL, with no obvious advantages.

Brian


;=====================================================
PRO example

a= 1
b= FLTARR(3)
c= OBJ_NEW('vector3')

<<hypothetical complicated useful code>>

RETURN
END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Link IDL to ORACLE Pro*FORTRAN
Next Topic: Neural network simulation in IDL?

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

Current Time: Wed Oct 08 13:45:43 PDT 2025

Total time taken to generate the page: 0.00452 seconds