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

Syntactical oddity with numeric literals and end #34457

Open
yurivish opened this issue Jan 21, 2020 · 0 comments
Open

Syntactical oddity with numeric literals and end #34457

yurivish opened this issue Jan 21, 2020 · 0 comments
Labels
parser Language parsing and surface syntax

Comments

@yurivish
Copy link
Contributor

yurivish commented Jan 21, 2020

Currently, a space is not needed between a numeric literal inside of a block and the end delimiter.

For example:

julia> struct Foo 3end

julia> begin 2end
2

julia> let; 8end
8

julia> let x=3; x^2end
9

There was some agreement in the Slack channel that this is weird.

It may not be weird enough to warrant action and is certainly not as entertaining as this oddity but seemed worth mentioning.

I also found this related example where numeric juxtaposition is parsed in one case but not the other:

julia> 10primitive type Bar 16 end
ERROR: MethodError: no method matching *(::Int64, ::Nothing)
Closest candidates are:
  *(::Any, ::Any, ::Any, ::Any...) at operators.jl:529
  *(::T, ::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:54
  *(::Union{Int16, Int32, Int64, Int8}, ::BigInt) at gmp.jl:523
  ...
Stacktrace:
 [1] top-level scope at REPL[46]:1

julia> 10struct Baz end
ERROR: syntax: extra token "struct" after end of expression
@JeffBezanson JeffBezanson added the parser Language parsing and surface syntax label Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

2 participants