Skip to content
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

Host some tool R code in share/jupyter/kernels/xr/R directory #14

Merged
merged 7 commits into from
Oct 25, 2023

Conversation

romainfrancois
Copy link
Contributor

@romainfrancois romainfrancois commented Oct 24, 2023

The idea here is to have a place where we can have some R code, instead of doing inlines as in e.g.

const char* try_catch = ".xeus_try_catch <- function(expr) {.xeus_sys_calls <- NULL; tryCatch(withCallingHandlers(withVisible(eval(expr, globalenv())), error = function(condition){sys_calls <- sys.calls(); sys_calls <- sys_calls[seq(10, length(sys_calls))];.xeus_sys_calls <<- sys_calls}), error = function(condition) { structure(list(condition = condition, calls = .xeus_sys_calls, stack = capture.output(traceback(.xeus_sys_calls, max.lines = 1L)) ), class = 'xeus_error')})}";

which will quickly become error-prone and not easily maintainable.

This will be useful for e.g. #13

@@ -208,10 +206,22 @@ SEXP try_parse(const std::string& code, int execution_counter) {

void interpreter::configure_impl()
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit over the top, but the idea here is to figure out where xr is and then find the ../share/jupyter/kernels/xr/R/setup.R file and source() it.

Are there better ways to host extra files ?

@romainfrancois romainfrancois merged commit ef8ab39 into main Oct 25, 2023
@romainfrancois romainfrancois deleted the rcode branch October 25, 2023 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant