Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
L ldpl
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 8
    • Issues 8
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Lartu
  • ldpl
  • Issues
  • #113

Closed
Open
Created Jun 09, 2019 by Lartu@lartu🐕Maintainer

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

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking