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

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

Thread Previous | Thread Next
From:
Todd Rinaldo
Date:
July 15, 2010 08:37
Subject:
Re: [perl #76402] [PATCH] Locale::Maketext One Sided Lexicons
Message ID:
4DF61ADA-BCAF-4F1B-9AA6-68B5073C5D79@cpanel.net

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: http://rt.perl.org/rt3/Ticket/Display.html?id=76402 >
>> 
> 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.
> 


Jesse,

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.

Thanks,
Todd Rinaldo
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About