Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const in local scope? #46562

Closed
jw3126 opened this issue Aug 31, 2022 · 1 comment
Closed

const in local scope? #46562

jw3126 opened this issue Aug 31, 2022 · 1 comment

Comments

@jw3126
Copy link
Contributor

jw3126 commented Aug 31, 2022

Currently one cannot declare local variables const:

julia> function f()
           const x = 1
       end
ERROR: syntax: unsupported `const` declaration on local variable around REPL[1]:2
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1

From time to time I wish this was possible.

  • Would it be hard to implement that?
  • Are there subtle questions about the semantics of this?
@fredrikekre
Copy link
Member

#5148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants