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

size fails in setup #39

Closed
gaocegege opened this issue May 9, 2017 · 5 comments
Closed

size fails in setup #39

gaocegege opened this issue May 9, 2017 · 5 comments

Comments

@gaocegege
Copy link
Member

setup <- function()
{
    processing$size(200,200)
}
org.renjin.eval.EvalException: size() cannot be used here, see https://processing.org/reference/size_.html
	at org.renjin.eval.Context.evaluateCall(Context.java:307)
	at org.renjin.eval.Context.evaluate(Context.java:218)
	at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:46)
	at org.renjin.eval.Context.evaluateCall(Context.java:298)
	at org.renjin.eval.Context.evaluate(Context.java:218)
	at org.renjin.eval.Context.evaluate(Context.java:165)
	at org.renjin.sexp.Closure.doApply(Closure.java:107)
	at rprocessing.RLangPApplet.setup(RLangPApplet.java:158)
	at processing.core.PApplet.handleDraw(PApplet.java:2395)
	at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1540)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
Caused by: java.lang.IllegalStateException: size() cannot be used here, see https://processing.org/reference/size_.html
	at processing.core.PApplet.insideSettings(PApplet.java:938)
	at processing.core.PApplet.size(PApplet.java:1981)
	at rprocessing.applet.BuiltinApplet.size(BuiltinApplet.java:20)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.renjin.invoke.reflection.FunctionBinding$Overload.invoke(FunctionBinding.java:90)
	at org.renjin.invoke.reflection.FunctionBinding.invoke(FunctionBinding.java:149)
	at org.renjin.invoke.reflection.FunctionBinding.evaluateArgsAndInvoke(FunctionBinding.java:131)
	at org.renjin.invoke.reflection.MethodFunction.apply(MethodFunction.java:41)
	at org.renjin.eval.Context.evaluateCall(Context.java:298)
	... 10 more
@jeremydouglass
Copy link
Member

This might be related to the preprocessor.

I could be wrong, but it is possible that ~Processing 3.0+ uses the preprocessor to move size() from setup() into settings(). The mechanism may be slightly different then the simplified way it is explained in the public reference:

@gaocegege
Copy link
Member Author

I have implemented a simple pre-processor here

I am not sure if it works in this situation. I will have a look soon.

@jeremydouglass
Copy link
Member

Possibly related example of the Java preprocessor:

processing/processing#5065 (comment)

@gaocegege
Copy link
Member Author

Related with #51 or #9

gaocegege referenced this issue Jun 7, 2017
Signed-off-by: Ce Gao <ce.gao@outlook.com>
@gaocegege
Copy link
Member Author

dup with #51

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