Skip to content

Allow interpolation into @remote calls #53

@KronosTheLate

Description

@KronosTheLate

Based on this thread, it is possible to process a macro to allow interpolating of values. My use case is that I want to define something like

function get_ADC(addr, bit)
    @remote(pyconvert(Float32, DAQC2.getADC($addr, $bit)))
end

to make it feel like a pure julia function. If I do not interpolate, I get an error from addr and bit not being defined remotely, which makes sense. However, I can not interpolate the arguments into the call to @remote, due to a RemoteException:


ERROR: RemoteException:
  ERROR: syntax: "$" expression outside quote
  Stacktrace:
   [1] top-level scope
     @ none:1
   [2] eval
     @ ./boot.jl:360 [inlined]
  
Stacktrace:
 [1] (::RemoteREPL.var"#47#48"{RemoteREPL.Connection, Expr})()
   @ RemoteREPL ~/.julia/packages/RemoteREPL/BFqrB/src/client.jl:391
 [2] ensure_connected!(f::RemoteREPL.var"#47#48"{RemoteREPL.Connection, Expr}, conn::RemoteREPL.Connection; retries::Int64)
   @ RemoteREPL ~/.julia/packages/RemoteREPL/BFqrB/src/client.jl:178
 [3] ensure_connected!
   @ ~/.julia/packages/RemoteREPL/BFqrB/src/client.jl:174 [inlined]
 [4] remote_eval_and_fetch
   @ ~/.julia/packages/RemoteREPL/BFqrB/src/client.jl:380 [inlined]
 [5] get_ADC(addr::Int64, bit::Int64)
   @ Main ~/Uni/Semester/8. Sem/Independent Study Activity/scripts/test.jl:24
 [6] top-level scope
   @ ~/Uni/Semester/8. Sem/Independent Study Activity/scripts/test.jl:26

The fix would perhaps be to do something like benchmark-tools, as seen in the linked post, to allow interpolation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions