JuliaWeb / JuliaWeb/RemoteREPL.jl

Allow interpolation into @remote calls

Open
#53 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
145
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Based on [this thread](https://discourse.julialang.org/t/interpolation-in-macro-calls/25530/3), 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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.