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

static function is not found in RLangPApplet instance in renjin #97

Open
gaocegege opened this issue Jun 6, 2017 · 9 comments
Open

Comments

@gaocegege
Copy link
Member

gaocegege commented Jun 6, 2017

Update summary:

renjin does not currently offer core support for accessing static methods/fields via an instance (bedatadriven/renjin#320). The workaround (e.g. in #134) was to map static functions from RLangApplet in core.R (https://github.com/gaocegege/Processing.R/blob/master/src/rprocessing/r/core.R#L187) -- however if renjin adds core support for static access in the future this could be dropped.


radians is a function in PApplet, I am not sure why it raises an error with #95

Instance of class rprocessing.RLangPApplet has no member named 'radians'

It fails examples/Basics/Trigonometry

@gaocegege
Copy link
Member Author

I have found the cause, we will meet the problem when radians, ceil and so on is called.

It seems that renjin couldn't handle the static function well. processing$radians(...) works, but

radians = processing$radians
radians(...)

will return Instance of class rprocessing.RLangPApplet has no member named 'radians'

And

import(rprocessing.RLangPApplet)
radians = RLangPApplet$radians
radians(...)

works well.

@gaocegege gaocegege changed the title radians is not in RLangPApplet instance static function is not found in RLangPApplet instance in renjin Jun 7, 2017
@gaocegege
Copy link
Member Author

gaocegege commented Jun 7, 2017

ref bedatadriven/renjin#320

We could wait the renjin to fix the problem

@jeremydouglass
Copy link
Member

Good investigation, and a clear bug report to renjin.

They have been very responsive and supportive so far. Let's see what effort level it would take for renjin to add static variable support, and what kind of priority they can make it.

@gaocegege
Copy link
Member Author

Thank 😄

We have two options, actually:

  1. Wait until there is a PR to fix the problem, or file a PR to renjin and fix the problem on our own. Then we could wrap these static functions by xxx = processing$xxx
  2. Use xxx = RLangPApplet$xxx instead

And I think we could put the issue to low priority since there is only one function used in the examples. If the issue will be there for a long time, then we could use the latter way to avoid it.

@jeremydouglass
Copy link
Member

jeremydouglass commented Jun 7, 2017 via email

@gaocegege
Copy link
Member Author

gaocegege commented Jul 3, 2017

Done by some tricks in core.R #134

But I think we could keep this open for renjin's update

@gaocegege gaocegege reopened this Jul 3, 2017
@jeremydouglass
Copy link
Member

Sounds good. Static functions are implemented with the workaround -- but if renjin adds core support for static functions then we can incorporate that.

@jeremydouglass
Copy link
Member

  1. Use xxx = RLangPApplet$xxx instead
    [...] If the issue will be there for a long time, then we could use the latter way to avoid it.

I've asked a follow-up on this feature for renjin, but I think I will go ahead with option 2 for the next release so that we fix the bug / add the feature. We can change the implementation later if renjin changes.

@jeremydouglass jeremydouglass added this to the v1.0.8 milestone Aug 6, 2019
@gaocegege
Copy link
Member Author

SGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants