Thomas, thank you very much for your input. I think I will keep coding
using method chaining and now at least I know they are not free in terms of
code size and performance. Also I will test how this behaves introducing
closure. Also I have made some little tests, the most interesting is using
setters like this:
public native final JsFriendlyBeam age(int val) /*-{
var v = this;
v["age"]=val;
return v;
}-*/;
In that case, the result of translating "chained" setters like
JsFriendlyBeam.create().color("turttlered2").age(14).head(JavaScriptObject.createObject());
is the following JavaScript output:
jsFriendlyBeam = (v = (v_1 = (v_0 = {} , v_0['color'] = 'turttlered2' ,
v_0) , v_1['age'] = 14 , v_1) , v['head'] = {} , v);
There the jsni is inlined like I want but at the cost of introducing new js
variables v_# for each method call.
It do not occurs me how the setter chaining can be translated inline to
javascript withtou introducing extra js functions of variables, so perhaps
it is impossible. Thank you for the feedback.!
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/IkqNosBuR-AJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.