Julia: Macro juxtaposition behaviour is a bit weird

Created on 19 Jul 2017  路  1Comment  路  Source: JuliaLang/julia

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.

deprecation macros parser

Most helpful comment

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

>All comments

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

Was this page helpful?
0 / 5 - 0 ratings