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

Macro juxtaposition behaviour is a bit weird #22868

Closed
swt30 opened this issue Jul 19, 2017 · 1 comment
Closed

Macro juxtaposition behaviour is a bit weird #22868

swt30 opened this issue Jul 19, 2017 · 1 comment
Assignees
Labels
kind:deprecation This change introduces or involves a deprecation macros @macros parser Language parsing and surface syntax
Milestone

Comments

@swt30
Copy link
Contributor

swt30 commented Jul 19, 2017

julia> var = 3
3

julia> var@time 2
  0.000001 seconds (3 allocations: 144 bytes)
6

julia> var@ time 2
  0.000001 seconds (3 allocations: 144 bytes)
6

julia> var @time 2
ERROR: syntax: extra token "@" after end of expression

julia> @time 2@time 2
  0.000000 seconds (3 allocations: 144 bytes)
  0.000215 seconds (76 allocations: 1.969 KiB)
4

julia> @time 2@   time 2
  0.000000 seconds (3 allocations: 144 bytes)
  0.000209 seconds (76 allocations: 1.969 KiB)
4

Seems a bit odd to allow juxtaposition with something that isn't a literal here, or to allow a space after the opening @ of a macro.

@JeffBezanson
Copy link
Sponsor Member

JeffBezanson commented Jul 19, 2017

Yes let's disallow spaces between @ and the macro name, and disallow this juxtaposition.

@JeffBezanson JeffBezanson added parser Language parsing and surface syntax kind:deprecation This change introduces or involves a deprecation labels Jul 19, 2017
@JeffBezanson JeffBezanson self-assigned this Jul 19, 2017
@StefanKarpinski StefanKarpinski added this to the 1.0 milestone Jul 19, 2017
@ararslan ararslan added the macros @macros label Jul 19, 2017
JeffBezanson added a commit that referenced this issue Jul 20, 2017
fix #22868, parse errors for `x@time` and `@ time`
jeffwong pushed a commit to jeffwong/julia that referenced this issue Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:deprecation This change introduces or involves a deprecation macros @macros parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

4 participants