jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Huntwork <...@huntwork.net>
Subject Re: accessing local variables
Date Mon, 12 Jul 2004 14:32:29 GMT
Not only not allowed by the spec, but it doesn't necessarily even make 
any sense as stated.  If a function has never been invoked, what do you 
want the values of its variables to be?  Some languages have nested 
functions and i think usually nested functions a) can only be called 
from their outer function; and b) have access to the most recent 
invocation of the enclosing function.  Something like this:

function a() {
   function b() {
     return c;
   }
   if(bar())
     a();
   int c = foo();
   int d = b();
}

a recurses, but you usually expect that b will access c in the most 
recent invocation.

I think it would be somewhat painful but definitely possible to 
implement nested functions using bcel to copy local variable values into 
global vars before invoking the nested function.  or something like 
that.  but that's certainly not the exact question asked.

Dick Eimers wrote:
>> Is there a way to access local variables declared in a function in
>> another function during run time.
> 
> 
> No this is not allowed by spec.
> 
> -Dick
> 
> 
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org For
> additional commands, e-mail: bcel-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


Mime
View raw message