Skip to content

Local Variable Scope #145

Closed
Closed

Description

@HzanRsxa2959

Sorry if this has been talked about before, but I didn't find any mention of it.

With the introduction of named local variables (#32), a way should be added add scope to them to avoid any potential name conflicts with opcode 0AB1.

Activity

  1. x87 commented on Jun 6, 2021

    @x87
    Collaborator

    @HzanRsxa2959 I think I understand what you are asking for, but can you please provide a few code examples where scoped variables are used?

  2. HzanRsxa2959 commented on Jun 6, 2021

    @HzanRsxa2959
    Author

    @x87 Here is some example code with the issues commented:
    https://pastebin.com/9CyWwS38
    Tested on Sanny Builder 3.7.0 released on 2021-1-30.

    EDIT:
    Also, I can't think of any example where nesting is necessary at all for scopes, at least in SCM.

  3. added and removed
    discussion
    on Jul 6, 2021
  4. added
    runtime limitation
    on Jul 28, 2021
  5. x87 commented on Sep 2, 2023

    @x87
    Collaborator

    another example

    {$CLEO}
    
    int x = 0
    int y = 1
    0AB1: cleo_call @fn 0
    
    // cleo_call creates a local scope
    :fn
    int y = 1   // this is not the same 'y' as defined in the outer scope
    cleo_return 0
    
  6. added
    type:feature
    priority:p2
    and removed
    runtime limitation
    on Sep 2, 2023
  7. x87 commented on Jan 12, 2024

    @x87
    Collaborator

    This is solved in 4.0 with the introduction of function syntax #263

  8. added this to the v4.0.0 milestone on Jan 12, 2024
  9. x87 commented on Aug 7, 2024

    @x87
    Collaborator

    released in 4.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:p2scope:compilertype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions