On Wed, Jan 19, 2011 at 20:23, Mark S. Miller <erig...@google.com> wrote: > On Wed, Jan 19, 2011 at 5:02 PM, Nebojša Ćirić <c...@google.com> wrote: >> >> Eric proposed to remove the derive method from all API objects and do >> something like this: >> var loc = new LocaleInfo({....}); // {...} are the options we construct >> LocaleInfo object with. >> var opt2 = loc.options; // This returns a copy of options from loc >> object. >> opt2.currency = "USD"; >> var loc2 = new LocaleInfo(opt2); > > The above code does suggest that the assignment is changing the options that > are stored at loc.options. That is of course not the intention. Either it > should give a fresh mutable copy on each request or it should give frozen > options object. The first was intended. On reflection, I think it would be > clearer if options were obtained using a method call such as "loc.options()" > rather than using an accessor with non-storage semantics.
I agree that having a method that returns a copy of the options is clearer. -- erik _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss