Allow interpolation into @remote calls

Open
#53 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia
Domain
devtools

Research direction

Start with the failing @remote call and the RemoteREPL client.jl location shown in the stack trace, then review the linked Julia discourse thread and its benchmark-tools approach. The work is done when values such as addr and bit can be interpolated into @remote calls without a remote "$" syntax error and the get_ADC example executes successfully.

Written by the indexing model from the issue text.

Description

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?

Dominant language
Julia
Stars
148
Forks
17
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JuliaWeb/RemoteREPL.jl

All issues in JuliaWeb/RemoteREPL.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.