develooper Front page | perl.perl5.porters | Postings from July 2010

Re: [perl #76402] [PATCH] Locale::Maketext One Sided Lexicons

Thread Previous | Thread Next
Todd Rinaldo
July 15, 2010 08:37
Re: [perl #76402] [PATCH] Locale::Maketext One Sided Lexicons
Message ID:

On Jul 8, 2010, at 8:57 AM, Jesse Vincent wrote:

> On Tue  6.Jul'10 at  9:43:59 -0700, Todd Rinaldo wrote:
>> # <URL: >
> Locale::Maketext already has functionality to do what you want. 
> The _AUTO meta-entry in %Lexicon allows fallthrough to use the requested
> $key as the $value.  And then your base lexicon uses even _less_ memory.
> The value of having your translators hand-copy the content of your
> default lexicon doesn't feel like much of a win for the added
> complexity.


Onesided-ness is a complementary feature to _AUTO, not a replacement. 

When you have code that uses _AUTO, Locale fall back happens. The only way to prevent this is to inject a key with an equivalent value to prevent fallback. Sometimes unexpected defaulting might happen. This isn't something you'd use all the time, but in the cases where you do, onesided-ness is more "fat-finger safe" than duping key and value pairs.

Having key/value pairs is also useful when you have _AUTO off. In those cases, the only way have MT not break is to put in a key with an equivalent value. Again, you're more  "fat-finger safe" by using one sidedness in those cases.  

The added complexity only happens once when the statement is compiled, so it shouldn't be that expensive from a code path standpoint.

Todd Rinaldo
Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About