Andres,
  You might want to wait a day or two. I think Brian started one by copy
and pasting your proposals and mine into a doc, it might be better for him
to make it public and we all hack on that.



On Fri, Aug 9, 2013 at 12:19 PM, Andrés Testi <[email protected]>wrote:

> Ray:
>
> I'm writing a design doc like "Nextgen GWT/JS Interop", but for
>  "Relaxation of GWT.create()". I don't know if there are previous official
> efforts to bring something like this to life, but if so, I would like know
> about similar experiences.
> Is there a guideline for these kind of design doc? When I finish a first
> document draft, I will share it.
> Thanks!
>
> - Andrés
>
> El miércoles, 7 de agosto de 2013 14:31:01 UTC-3, Ray Cromwell escribió:
>>
>> The annotations were also there to allow the compiler to do error
>> checking so that class-literal propagation was always possible. So if you
>> write a function foo(Class<?> klazz), that then calls GWT.create(klazz),
>> there will be a compile time error thrown if foo() is not called with a
>> literal, just like GWT.create(). This means that it will always be possible
>> to propagate the class literal from parameter to use.
>>
>>
>>
>>
>> On Wed, Aug 7, 2013 at 5:31 AM, Andrés Testi <[email protected]>wrote:
>>
>>> Hi Ray. I would like to add your proposal to my patch and generalize
>>> GWT.create() relaxation. I think your annotation @GwtCreate(generator=...)
>>>  would solve my problem with the GWT frameworks tendency to instantiate
>>> everything with GWT.create() instead of new.
>>> As Matt Mastracci proposed here https://groups.google.com/d/**
>>> msg/google-web-toolkit-**contributors/_jf8vBC8QDI/**X9LDLTbqB64J<https://groups.google.com/d/msg/google-web-toolkit-contributors/_jf8vBC8QDI/X9LDLTbqB64J>
>>>  a
>>> better approach is to generate a GwtCreateFactory to replace @GwtCreate
>>> Class fields and params.
>>> I will elaborate a more advanced proposal with all of these in account.
>>> Thanks!
>>>
>>> - Andrés
>>>
>>> El lunes, 5 de agosto de 2013 20:37:45 UTC-3, Ray Cromwell escribió:
>>>>
>>>> Hey Andres, I haven't fully looked at this, but I'm overjoyed you're
>>>> working on it, and it seems promising. One thing you might want to do is
>>>> review one of my old proposals on allowing any method to delegate
>>>> parameters to GWT.create(), see here: http://timepedia.**blogspo**
>>>> t.com/2009/03/relaxing-**constra**ints-on-gwtcreate.html<http://timepedia.blogspot.com/2009/03/relaxing-constraints-on-gwtcreate.html>
>>>>
>>>> I'm wondering if your work could be adapted to support this.
>>>>
>>>> -Ray
>>>>
>>>>
>>>>
>>>> On Mon, Aug 5, 2013 at 8:36 AM, Andrés Testi <[email protected]>wrote:
>>>>
>>>>> Are there interest adding support for allowing
>>>>> GWT.create(this.getClass()) invocations?
>>>>> I wrote an experimental patch to support it, adding a few changes to
>>>>> UnifyAst. I've added the patch as an attached file, because I don't have
>>>>> yet a CLA (I know this is not the right way to proceed).
>>>>> There are many usecases for this feature, based in the super type
>>>>> token pattern (http://gafter.blogspot.com.**ar**
>>>>> /2006/12/super-type-tokens.**htm**l<http://gafter.blogspot.com.ar/2006/12/super-type-tokens.html>).
>>>>> I've named this feature as Self Generated Objects (selfgen).
>>>>>
>>>>> * Some use cases are:
>>>>> -- Hide invocations to GWT.create()
>>>>> -- Reduce boilerplate, minimizing the need of extend interfaces like
>>>>> UiBinder, EditorDriver, etc..
>>>>>       Example, a custom composite :
>>>>>
>>>>> abstract class UiBinderComposite extends Composite {
>>>>>   protected UiBinderComposite() {
>>>>>     UiBinder<Widget, UiBinderComposite> binder =
>>>>> GWT.create(this.getClass());
>>>>>     initWidget(binder.**createAndBin**dUi(this));
>>>>>   }
>>>>> }
>>>>>
>>>>> // Usage:
>>>>> @UiTemplate("mywidget.ui.xml")
>>>>> class MyUiBinderWidget extends UiBinderComposite {
>>>>>
>>>>>   @UiField
>>>>>   Button clickMe;
>>>>> }
>>>>>
>>>>> -- Allow runtime type information on demand (Stroustrup’s
>>>>> zero-overhead rule: “what you don’t use, you don’t pay for”) by means of
>>>>> emulation of guava's TypeToken
>>>>>     Example:
>>>>> abstract class TypeToken<T> {
>>>>>
>>>>>   private final TypeInfo<T> typeInfo;
>>>>>
>>>>>   protected TypeToken() {
>>>>>     typeInfo = GWT.create(this.getClass());
>>>>>   }
>>>>>
>>>>>   ...
>>>>> }
>>>>>
>>>>> // Usage
>>>>> new TypeToken<List<String>>(){}
>>>>>
>>>>> * Implementation
>>>>> To support this feature, my patch searchs for
>>>>> GWT.create(this.getClass()) invocations, and replaces they with an
>>>>> invocation to a syntetic method named this$create. This method is added to
>>>>> the current class, and is implemented for each non abstract subclass,
>>>>> returning an invocation to GWT.create(currentClass).
>>>>>
>>>>> * Problems found with this implementation:
>>>>> -- Anonymous classes are hidden to generators, and it is unable to do
>>>>> something like new TypeToken<List<String>>(){}. Workaround: Expose these
>>>>> classes.
>>>>> -- GWT frameworks have a tendence to instantiate user objects calling
>>>>> GWT.create() instead of new operator. With GWT.create(this.getClass()) we
>>>>> want to instantiate a diferent class, like UiBinder in UiBinderComposite.
>>>>> Workaroud: Provide a flag to generators reporting if the invocation was
>>>>> from a class literal or a this.getClass() invocation.
>>>>>
>>>>> I've added a sample application to my patch, called HelloSelfgen,
>>>>> demostrating how to write a self generated UiBinderComposite.
>>>>>
>>>>> Regards.
>>>>>
>>>>> - Andrés
>>>>>
>>>>> --
>>>>> http://groups.google.com/**group**/Google-Web-Toolkit-**Contributo**rs<http://groups.google.com/group/Google-Web-Toolkit-Contributors>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "GWT Contributors" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to google-web-toolkit-**contributor**s+unsubscribe@**
>>>>> googlegroups.com**.
>>>>> For more options, visit 
>>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out>
>>>>> .
>>>>>
>>>>>
>>>>>
>>>>
>>>>  --
>>> http://groups.google.com/**group/Google-Web-Toolkit-**Contributors<http://groups.google.com/group/Google-Web-Toolkit-Contributors>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "GWT Contributors" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to google-web-toolkit-**contributors+unsubscribe@**
>>> googlegroups.com.
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>  --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
> ---
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to