I guess we should throw when creating an object (should .derive() throw then too?), but not when returning a property (say .region).
24. јануар 2011. 10.11, Shawn Steele <[email protected]> је написао/ла: > My understanding of “inferred” values for the LocaleInfo object is that, > when inferred is allowed/used, that values which are not explicitly > specified in the constructor (eg: calendar), will be inferred as best as > possible from the other inputs. > > > > For example: If I construct it with: > > var myLocale = new LocaleInfo( { localeName: “en-US”, inferDetails: “true” > } ); > > then it could return a Gregorian calendar for > > var cal = myLocale.calendar; > > > > And, if it wasn’t obvious, it could fall back to defaults: > > var klingon = new LocaleInfo( { localeName: “tlh”, > inferDetails: “true” } ); > > var cal = klingon.calendar; // ends up at Gregorian > because there’s no real data here. > > > > If inferred is false, then should it fail by returning undefined or throw > an error? > > var klingon = new LocaleInfo( { localeName: “tlh”, > inferDetails: “false” } ); > > var cal = klingon.calendar; // throw or undefined? > > > > Throwing seems a bit heavy to me, however it also seems a bit “safer.” In > the i18n meeting we’d said that errors would throw, however testing for > whether or not a valid value was available seems to me more like a normal > condition than an exception. > > > > > > - Shawn > > > > > > http://blogs.msdn.com/shawnste > > (Selfhost 7908) > > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > > -- Nebojša Ćirić
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

