NEW Array,done    ; Array and done pushed on the stack
SET done=0        ;
FOR  DO  Q:done   ; DO pushes a new frame on the stack
.                 ; If NEW variable here, value will pop with DO frame
. KILL Array      ; 
. I $$Up(.Array) D ...    ; Array is updated
. set done=1      ;
. Q               ; Explicit or implicit Q will pop DO frame
                  ; References to Array,done here will be valued
                  ; as they were set in the loop
Q                       ; Explicit or implicit Q will pop this frame
                  ; with it go the current values of Array,done
                  ;

The scope of the NEW lasts until the next QUIT at the same level.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin
Toppenberg
Sent: Saturday, February 11, 2006 10:55 PM
To: [email protected]
Subject: Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really
happening?

OK.  Bad example.  Here is a closer one to what I am working on.

...
new Array,done
set done=0

for  do  quit:done
. kill Array
. if $$UpdateInfo(.Array)=1 do SOMETHING
. (more logic here)
. set done=(some logic)

So here we have Array NEW'ed outside the loop.  Array is used
primarily as an OUT parameter from function UpdateInfo().  The
function may be called repeatedly unto the done= logic is satisfied. 
I want to ensure that there are not residual data in Array from the
last cycle, so I kill Array before the call.  But I want to be able to
use the Array later outside the loop.

So my question was the status of the symbol table when I had NEW'd a
variable outside a loop, and then KILLed it in the loop.  I wondered
if any prior values were popped off the storage stack etc.

Kevin








On 2/11/06, Gregory Woodhouse <[EMAIL PROTECTED]> wrote:
>
> On Feb 11, 2006, at 6:15 PM, Kevin Toppenberg wrote:
>
> >>>
> >>> Image this code:
> >>>
> >>> new i,Var
> >>> for i=1:1:10 do
> >>> . kill Var
> >>> . set Var=i
> >>> . write Var,!
>
> What do you accomplish with new i,Var in this code?
>
> ===
> Gregory Woodhouse
> [EMAIL PROTECTED]
>
> "Design quality doesn't ensure success, but design failure can ensure
> failure."
>
> --Kent Beck
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Hardhats-members mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hardhats-members
>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642
_______________________________________________
Hardhats-members mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Hardhats-members mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to