Hey, since I did it, let me help :-)

Basically, as you mentioned, it allowed a new statement to define 'scoped' regions that
would always have local variables. So, for instance, you could do:


PROGRAM A

Var1 = "Test"
PRINT "PreVersion of Var1 = ":Var1
GOSUB localSub1
PRINT "PostVersion of Var1 = ":Var1
STOP

localSub1:
$LOCALSTART     <--- New construct
   Var1 = "NewTest"
   PRINT "NewValue of Var1 = ":Var1
$LOCALEND

Would print
PreVersion of Var1 = Test
NewValue of Var1 = NewTest
PostVersion of Var1 = Test

In fact, the 'scoping' allowed you to provide this boundary mechanism at any point,
not just around subroutines, so you could have


A=9
PRINT A
$LOCALSTART
    A = 99
    PRINT A
$LOCALSTART
         A=999
         PRINT A
$LOCALEND
    PRINT A
$LOCALEND
PRINT A

would print :

9
99
999
99
9

Additionally, there was a mechanism to define 'global' variables that would span
LOCAL blocks, so that the newly defined global variable would be one that could
be modified in the LOCAL scopes, and have those changes reflected out, as well
as all for values to be started in.


All in all, a very interesting and potentially powerful concept... Worked great too...
Alas, it never went in...


And yeah, it took me all of about 2 days to put in...

Dave

At 09:58 AM 3/1/2004 -0500, you wrote:
This is an interesting topic as this concept within BASIC was actually developed and tested with great success here, though unfortunately never implemented for field release. I don't quite recall now how the implementation was done, but I believe there was a new statement used to indicate that an internal subroutine was either global or local and that would determine how variables were treated. I don't believe it was that difficult to implement either...

Anyways, it sure would be a nice feature in the real world!

At 09:49 AM 03/01/2004, you wrote:
> The only problem is that internal subroutines do not have local
> variables so
> the second call is using the same variables as its parent.  If this is a
> problem, using dynamic arrays to stack the necessary items is quite neat.
>

At the risk of sounding like an ad, there's an article at
http://www.precisonline.com/inner.html discussing the concept of "inner
recursion", that is, recursing inside of a single program.

--Kevin
[EMAIL PROTECTED]
http://www.PrecisOnline.com



--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users

-- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users

======================================================================== David T. Meeks || "All my life I'm taken by surprise Architect, Technology Office || I'm someone's waste of time Ascential Software || Now I walk a balanced line [EMAIL PROTECTED] || and step into tomorrow" - IQ ======================================================================== -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users

Reply via email to