I’m not sure what the property/object difference is?  Is it .region (an object) 
or .regionName (a string)?  I’d been assuming we’d return objects.  There 
shouldn’t be errors constructing the object itself, unless somehow you provided 
very invalid parameters (like inferDetals: “fred” instead of true or false).

-Shawn

From: Nebojša Ćirić [mailto:[email protected]]
Sent: Monday, January 24, 2011 11:32 AM
To: Shawn Steele
Cc: [email protected]
Subject: Re: Intent of i18n "inferred" values

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]<mailto:[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]<mailto:[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

Reply via email to