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
  • Merge requests
  • !42

Merged
Created Apr 09, 2019 by Lartu@lartu🐕Maintainer

Add GOTO & LABEL

  • Overview 2
  • Commits 1
  • Changes 2

Created by: dvkt

My boss is really getting on my case about the big rewrite of our cryptocurrency platform in LDPL. He says we're not going to be able to move fast and break things if we don't have GOTO in the language.

I told him most people think GOTO is more harmful than helpful, and that it's known to be especially dangerous in complicated systems, but he said that he looked up this Dijkstra guy and he wasn't impressed with his Github profile.

So anyway, this patch adds two new keywords to LDPL: GOTO and LABEL. They are just piggybacking C++'s goto, really. Pretty barebones.

They have to both be used together in the same sub-procedure or in the main code body of an LDPL program. So you can't goto across functions or anything like that.

Here's a little example script to test:

procedure:
GOTO start

LABEL start
display "> starting..." crlf

GOTO ending

LABEL middle
display "> entering the middle section..." crlf

sub-procedure cool-code
    GOTO cool
    display "hmm... is this cool?" crlf
    LABEL cool
    LABEL SUBPR_COOL_CODE
    display "wow, yeah! cool code!" crlf
end sub-procedure

LABEL ending
CALL cool-code
display "> that's the end" crlf

The output, you can see LABEL middle and the start of the cool-code subprocedure are skipped:

> starting...
wow, yeah! cool code!
> that's the end
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: github/fork/dvkt/goto