There's a type safe trick to doing it for all methods that return a value, see:
http://cromwellian.blogspot.com/2006_07_01_archive.html
which is based on this:
http://weblogs.java.net/blog/alexwinston/archive/2005/04/strongly_types_1.html
With my GWT.create() relaxation proposal, you could wri
On 29 mai, 02:18, Vitali Lovich wrote:
> It would be nice if there was a way to wrap Java methods with an opaque
> Javascript function object so that you could pass them around in the native
> code (obviously there are issues with compiler optimizations in this case).
> Ideally, you would be al
On Fri, May 29, 2009 at 11:59 AM, John Tamplin wrote:
> On Fri, May 29, 2009 at 11:31 AM, Vitali Lovich wrote:
>
>> The way you get a method reference in pure Java is via reflection, which
>>> in general is not feasible though there have been some discussions of
>>> allowing it when everything
On Fri, May 29, 2009 at 11:31 AM, Vitali Lovich wrote:
> The way you get a method reference in pure Java is via reflection, which in
>> general is not feasible though there have been some discussions of allowing
>> it when everything can be evaluated at compile time (ie, all constants for
>> clas
On Fri, May 29, 2009 at 11:16 AM, John Tamplin wrote:
> On Fri, May 29, 2009 at 10:42 AM, Vitali Lovich wrote:
>
>> I was thinking more along the lines of JavascriptFunction foo =
>> MyClass.bar.method or something like that. That way, you could do dynamic
>> function invocation without ever ne
On Fri, May 29, 2009 at 10:42 AM, Vitali Lovich wrote:
> I was thinking more along the lines of JavascriptFunction foo =
> MyClass.bar.method or something like that. That way, you could do dynamic
> function invocation without ever needing JSNI. It's also a lot easier to
> write that code, main
On Fri, May 29, 2009 at 9:42 AM, John Tamplin wrote:
> On Thu, May 28, 2009 at 8:18 PM, Vitali Lovich wrote:
>
>> It would be nice if there was a way to wrap Java methods with an opaque
>> Javascript function object so that you could pass them around in the native
>> code (obviously there are is
On Thu, May 28, 2009 at 8:18 PM, Vitali Lovich wrote:
> It would be nice if there was a way to wrap Java methods with an opaque
> Javascript function object so that you could pass them around in the native
> code (obviously there are issues with compiler optimizations in this case).
>
You can do
One possibility is to use hidden method parameters.
Let L = {the set of all method parameters which are referenced by
GWT.isLiteral() in the body}
For each parameter P in L, add a new parameter to the method, PiL (P
is Literal).
that is, in Vitali's example:
void addParameter (HashMap h, int si
It seems like the general functionality (i.e. GWT.isLiteral()) ought to be
implemented at the same time as method cloning. That's what makes me excited
about the whole thing. Otherwise, at least for me, it's hard to wrap my head
around how you could usefully emit different code for the same method
Cool, I had no idea GCC provided that information. I won't claim to be one
of the compiler gurus, but this sounds pretty feasible to me, and to Ray's
point, might be a useful way of loosening the GWT.create() magic a bit.
@Lex, Scott: What do you think? Is this relatively easy and useful?
On Mon,
Yeah, probably from a compiler's perspective, the value check may be more
complicated (the value may only be available after the AST stage depending
on when optimization is done)
It can possibly bloat the resultant code (since I believe you may have to
build different implementations of each funct
+1
I suggested a similar feature a few days ago privately, I called it
GWT.isLiteral(), since the underlying check is if its an AST literal
in the compiler, although in my example, you can't do value
comparisons, just assertions on the literal. The value checks would be
done via traditional opera
13 matches
Mail list logo