Skip to content

$x should become $(Ref(x))[]? #205

@stevengj

Description

@stevengj

It's a bit annoying when you have to use this convoluted Ref trick to prevent the compiler from constant-folding the whole calculation (ala #130):

julia> @btime exp(1);
  0.052 ns (0 allocations: 0 bytes)

julia> @btime exp($(Ref(1))[]);
  13.785 ns (0 allocations: 0 bytes)

It would be nicer if we could just use @btime exp($1) and the $ did the trick automatically.

(Another case just came up on discourse. cc @stillyslalom)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions