New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can extendr give up embedded usage? #583
Comments
Yes. The whole raison d'etre of the embedded mode is for testing. I had thought about making R libraries available on crates.io, too. We could provide a config to no op |
This would also make Robj reference counting much cheaper. |
I'm somewhat against this, and I'd like to elaborate soon on it. In the mean time, please don't do this before I've given my opinion on this. |
But has anyone answered the question of how we would do testing without embedded R? |
You cannot.
You cannot allocate.
…On Wed, 12 Jul 2023, 15.54 Michael Milton, ***@***.***> wrote:
But has anyone answered the question of how we would do testing without
embedded R?
—
Reply to this email directly, view it on GitHub
<#583 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIDVSGB77E6MR2UQRWXA5DXP2T7RANCNFSM6AAAAAA2HLTXUI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Oh, really? I didn't know this. Then, if only we can find some alternative way of testing, we might not need this. e.g. I was wondering if it's possible to inject fake libR for unit testing.
Don't worry, this would require enormous amount of efforts. No one can do this overnight :)
I already answered it. You'll always need a real R session and real R package for testing. I mean, "testing" is possible, but unit test is not. |
Anyway, I don't have energy to make this a reality. I'll keep experimenting with my toy crate in the hope I can reflect the achievements to extendr someday. Thank you all for your quick responses. At the moment, stopping relying on |
I've come around to this idea, and in fact I think we should have an Users that want to use R in their rust crates will have many, many more needs than what (I failed to find this issue again, but @yutannihilation just linked it again, thanks!) |
Just in case you don't realize (or forget) how horrible thing this is, let me highlight the The C string underlying https://github.com/wch/r-source/blob/ad9c596f97904f330c03cfaed9f8ff21200ed9de/src/main/names.c#L1221 The pointer address of this However, in extendr, it's not possible because the pointer of the You might argue that extendr anyway needs to be concurrency-proof, but I bet this isn't a concurrency that happens on a real R session. It's probably that multiple R sessions created by extendr-engine weirdly share some state. I haven't heard running multiple R process causes such an error. I feel it's insane to have such a cryptic code below just to avoid the error that can only happen in embedded usage. Lines 5 to 22 in 89a6e23
|
Oh I have forgotten about this. It must have been on my mind, because I made #624, which basically checks if R's I feel like you're posting a lot of poignant information and issue, and I'm not arguing against it really. I would love it if you made an issue about keeping the concurrency, or getting rid of it. Don't you think it makes a little bit of sense to try and attack these problems anyways? I've already made a lot of progress on this particular issue, and a few others. I am very positive that we together could get through this and many other things to be fair.. If you have ideas for the concurrency tests, please throw them my way. I will support it if you'd put forth, that |
Why? I think you should file an issue about starting to support the concurrency, or not1. I don't think it's the consensus that concurrency is in the current scope of extendr. Am I wrong? If so, it probably means I should fade out from the extendr project because it seems I'm completely lost in the discussion. Also, I'm not proposing dropping the (non-existent) support of concurrency here. I'm just expressing my feeling that I'm super tired of all the problems that embedded usage have been causing. Footnotes
|
Dear @yutannihilation, There are zero discussions being had without you. This "stuff" comes from me I didn't put a reply in your original issue, because I am not that articulate, or knowledgeable. I think your example can be fixed. I can propose a fix for it. It doesn't mean I don't support that we go away from this, But I will start the discussion! You already gave me a few points. I'll maybe suggest a PR to deal with the absence of symbols A side note: Thanks for your extensive comment on #646, I didn't know.. most of what you wrote 😅. |
I'm fine either with or without me. |
Seriously, I believe it makes things super complicated for extendr to support both R package use and embedded use. Does it really worth to support the embedded usage?
The recent trouble about the path to
libR.so
is the case; libR-sys setsrustc-link-search
, but this isn't used for R packages because linking against libR happens AFTERcargo build
, iiuc. libR-sys'sbuild.rs
can be much simpler if it gives up the embedded usage.This tricky implementation of
NA
for&str
is also the case. See #483 (comment) for the details. In short, it handles the problems that can occur only when multiple R sessions exist, which should never happen as long as extendr is used in R packages.Placing
single_threaded()
here and there is also for this reason. I believe most of them are unnecessary except when it's used in some embedded usage. As long as it's called from R session, most of the things should be synchronous.But, to be fair, giving up embedded usage means you cannot have
extendr_engine()
, which means you cannot havetest!
macro, which means you cannot do any unit testing at all. You'll always need a real R session and real R package. So, I guess no one will agree with this idea, but let me express my frustration here.The text was updated successfully, but these errors were encountered: