sub-data sections
Created by: fireasembler
I have been toying with LDPL for a while now, and one of the things that irks me the most is the sheer amount of variables you need to create in order to hold stuff and not override the data of one of the other methods.
my proposed solution to this is SUB-DATA
sections. I am proposing that before every SUB-PROCEDURE
you will be able to declare an optional SUB-DATA
section. all variables declared inside a SUB-DATA
section act like local variables. they are only usable inside a SUB-PROCEDURE
and (optionally) are not reset after every call to the SUB-PROCEDURE
(in order to be compatible with the whole "variables are persistent between scopes thing the language has going on already) . they also should not have any naming conflicts with other internal variables (of other sub-procedures).
example:
DATA:
i is number
PROCEDURE:
SUB-DATA:
x is number
SUB-PROCEDURE foo
incr x
display x " "
end SUB-PROCEDURE
while is less than 10 do
call foo
repeat
#stdout should be: 0 1 2 3 4 5 6 7 8 9
tl;dr: persistent local variables