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

Re: delvar




In article <36c05a04.0@208.206.112.5> "Dominic Zarro" 
<zarro@tidalwave.net> writes:

> Actually, my last response was incorrect.
> A better way, using pointers is as follows:
>
> ;-- to delete a variable var
>
> ;-- allocate a pointer
>
> *p=ptr_new(/all)

Hi Dominic, 

I guess you mean 

  p=ptr_new(/alloc)

(Seeing the "/all" in the ptr_new made me *really* confused,
I think the two extra letters are very clarifying :-)

[..]
>
> You can easily package the above into a simple
> procedure that deletes any variable var.

How about a one-line "syllogism": 

  ptr_free,ptr_new(temporary(var))

It's amazing what you have to do to delete a variable in IDL :-)

This discussion reminded me of a procedure I wrote some time in
1994, called like this:

      ASSIGN_NOCOPY,destination,source

This was way before temporary() appeared on stage, and it even
(still) has checks to function (resorts to copying) with IDL
3.0, which didn't even have the NO_COPY keyword in the
WIDGET_CONTROL,GET_UVALUE=var mechanism....

Then came the handles, and then... 

Which again reminds me - it would be *really* nice if RSI would
start putting in "Not before version X.XX" information in the
online documentation for (new) features. It's tiresome enough
trying to write version-sensitive code, and I just don't need
the extra work required to check exactly which of the current
features go back to this or that version...

Stein Vidar