Closed TheCedarPrince closed 1 year ago
Hi @TheCedarPrince , Good to hear that you still find the package to be useful!
In the first version of the package I actually wanted to make the syntax more Julia-like and I had implemented the following approach:
juliaImport("Pkg")
Pkg.activate("STUDY")
To achieve this, I had to use the attach
function. When I was trying it to publish it on CRAN, it was not going to be accepted like that. The reason was that functions in packages should not alter the search path. I had to switch to the current syntax to get the package accepted on CRAN. If one were to implement the suggested syntax with the ::
, I'm pretty sure that similar problems would arise when trying to publish this on CRAN because this would also require to alter the search path.
Oh interesting. I was confusing Julia metaprogramming syntax with R metaprogramming as I thought you could just "invent" your own syntax within R to mimic the standard ::
R operator. Since that may not be possible, another avenue of thought is could it be possible to import specific Julia functions? Like this for example:
library(JuliaConnectoR)
activate <- juliaImportFunction("import Pkg: activate")
activate("STUDY", shared = TRUE)
I know some masking could occur in this scenario but was thinking the juliaImportFunction
could bind the function Pkg.activate
as an object to activate
.
But yea, in terms of feedback from collaborators, they are fine using Julia as a backend for R, but there was some concern about syntax like pkg$activate
. I was thinking the above could be a potential compromise to address that concern.
What do you think?
Pkg$activate
is simply an R function. You can assign it to another R variable as any R function if you want:
> library(JuliaConnectoR)
> Pkg <- juliaImport("Pkg")
> activate <- Pkg$activate
> activate("STUDY", shared = TRUE)
Or like this, after a call to juliaImport
or juliaEval("import Pkg")
:
> activate <- juliaFun("Pkg.activate")
> activate("STUDY", shared = TRUE)
So there's no need for an extra function for that.
OH! I didn't realize you could do this:
activate <- juliaFun("Pkg.activate")
activate("STUDY", shared = TRUE)
That entirely solves what I was imagining! Thank you! I'll go ahead and close this issue. :)
Hi @stefan-m-lenz,
Hope you are well! I was working again with
JuliaConnectoR
recently and was wondering: is it possible to make the syntax usingJuliaConnectoR
even more R-Like? Meaning, for example, given this current syntax:Could it somehow be reformed to look like this:
Or even:
This was some feedback I had gotten from some collaborators when using the package within R. Otherwise, thanks for the great work!
~ tcp :deciduous_tree: