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

Re: delvar v/s reset_session



Thanks Pavel.  However, I think I've narrowed the problem down to
an even more bizarre phenomenon.  Try these commands in sequence
(not in a program, but on the command line):

	a=1 & b=2 & print,a,b
	help
	delvar,a
	help
	.reset_session
	help
	a=1 & b=2 & print,a,b
	help

Is it fair to conclude that you should not use .RESET_SESSION if
you've ever used DELVAR during the session?

Here's a log of what happens in my case:-

IDL> print,!version
{ sparc sunos unix 5.3 Nov 11 1999}
IDL> a=1 & b=2 & print,a,b
       1       2
IDL> help
% At  $MAIN$                 
A               INT       =        1
B               INT       =        2
Compiled Procedures:
    $MAIN$

Compiled Functions:

IDL> delvar,a
IDL> help
% At  $MAIN$                 
B               INT       =        2
Compiled Procedures:
    $MAIN$

Compiled Functions:

IDL> .reset_session
IDL> help
% At  $MAIN$                 
Compiled Procedures:
    $MAIN$

Compiled Functions:

IDL> a=1 & b=2 & print,a,b
% PRINT: Variable is undefined: A.
% Execution halted at:  $MAIN$                 
IDL> help 
% At  $MAIN$                 
A               UNDEFINED = <Undefined>
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
B               INT       =        2
                   < Press Spacebar to continue, ? for help >

-Vinay

In article <39F5AEC3.699E3A3D@cmdl.noaa.gov>,
Pavel Romashkin  <promashkin@cmdl.noaa.gov> wrote:
>All I can say is that the following was found in the IDL online help:
>
>The DELVAR procedure deletes variables from the main IDL program level.
>DELVAR frees any memory used by the variable and removes it from the
>main program's symbol table. The following restrictions apply:
>1. DELVAR can only be called from the main program level.
>2. Each time DELVAR is called, the main program is erased. Variables
>that are not deleted remain unchanged.
>
>Maybe, you should not use DELVAR in your code. If you worry about the
>size of temporary variables, you can un-define them using TEMPORARY or
>re-assign them to 0B.
>Cheers,
>Pavel
>
>"Vinay L. Kashyap" wrote:
>> 
>> Puzzle: Somehow, using .RESET_SESSION in between DELVARs seems
>> to confuse the IDL environment.  Now, I believe using DELVAR
>> inside even a main program is frowned upon (I don't know why),
>> but this seems very bizarre.r


-- 
______________________________________________________________________________
kashyap@head-cfa.harvard.edu         617 495 7173 [CfA/P-146] 617 496 7173 [F]