What John said. JSO cross-casts allow this.

On Thursday, March 25, 2010, John Tamplin <j...@google.com> wrote:
> On Thu, Mar 25, 2010 at 6:07 PM, Rodrigo Chandia <rchan...@google.com> wrote:
>
>
> (Sorry for the spam, Bruce. I forgot to press reply to all.)
>
> I seem to be missing some piece from the puzzle: in which way does
> freezing a MutableArray prevent the allocation of an ImmutableArray
> object?
>
> // This creates a new MutableArray instance
> MutableArray ma = CollectionsFactory.createMutableArray();
> ma.add("x");
> ma.add("y");
> ...
> // But freezing will also instantiate another object, right?
> ImmutableArray ia = ma.freeze();
>
> Internally, freeze will perform something like:
>
> return new ImmutableArrayImpl<E>(elem);
>
> Or is it that in prod mode we can do special tricks to avoid the creation?
> In Javascript, you simply cast MutableArray to ImmutableArrayImpl and return 
> the same object.
>
>
> --
> John A. Tamplin
> Software Engineer (GWT), Google
>
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>
> To unsubscribe from this group, send email to 
> google-web-toolkit-contributors+unsubscribegooglegroups.com or reply to this 
> email with the words "REMOVE ME" as the subject.
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

To unsubscribe from this group, send email to 
google-web-toolkit-contributors+unsubscribegooglegroups.com or reply to this 
email with the words "REMOVE ME" as the subject.

Reply via email to