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

Cannot declare symbols starting with a number using the ':' character #16678

Closed
amitmurthy opened this issue May 31, 2016 · 4 comments · Fixed by #32436
Closed

Cannot declare symbols starting with a number using the ':' character #16678

amitmurthy opened this issue May 31, 2016 · 4 comments · Fixed by #32436
Labels
docs This change adds or pertains to documentation

Comments

@amitmurthy
Copy link
Contributor

julia> :9A
ERROR: UndefVarError: A not defined
 in eval(::Module, ::Any) at ./boot.jl:225
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46

julia> :aA
:aA
@toivoh
Copy link
Contributor

toivoh commented May 31, 2016

This is to be expected, the : is for quoting Julia code, and not only for symbol literals. So only valid Julia identifiers can be retrieved as symbols this way. If you want to create other symbols, you have to use Symbol.

@amitmurthy
Copy link
Contributor Author

OK. Should be documented though.

@ivarne ivarne added the docs This change adds or pertains to documentation label May 31, 2016
@ivarne
Copy link
Member

ivarne commented May 31, 2016

See also #9945.

@amitmurthy
Copy link
Contributor Author

Maybe Stefan's answer from here - http://stackoverflow.com/questions/23480722/what-is-a-symbol-in-julia - can be edited and added to the manual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants