Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/awfulPublic

Add a !global construct #3

Open
@suve

Description

@suve

Currently functions have unfettered access to variables in higher scopes - be it the program's globals, or the caller's variables. This is a really stupid design decision that should be changed.

Proposed solution:

  • Limit functions to accessing only their local variables (and args/statics)
  • To use global variables, one must explicitly declare their use with!global $varname
  • The construct should probably be limited to the function's top-level scope (can't be put inside!if or loops)

Things to consider:

  • Should!global $var and!global &var be equivalent, or should the first one create a copy of the global variable in local scope (instead of adding a reference)?
  • What should happen when a function calls!global &var and&var hasn't been yet set?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp