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

RFC: What should the behavior be for user-defined casing?

Thread Next
From:
karl williamson
Date:
August 31, 2010 12:13
Subject:
RFC: What should the behavior be for user-defined casing?
Message ID:
4C7D543E.40309@khwilliamson.com
A user can define ToUpper() to override the default uppercasing, and 
similar functions for lower- and titlecasing.  It's always been known 
that this works only on utf8-encoded strings, and that it violates 
scoping rules, but I've been doing some experiments and discovered 
things that were surprises to me anyway, and contradict what I had 
previously patched perlunicode.pod to say, based on my more limited 
understanding.  I'm working on a patch that describes the current 
scoping issues, which look real ugly to me.  Here's what I've written as 
of now:

"This mechanism is not well behaved as far as affecting other packages
and scopes.  All programs have exactly one uppercasing behavior, one
lowercasing behavior, and one titlecasing behavior in effect for 
utf8-encoded strings for the duration of the program.  Each of these
behaviors is irrevocably determined the first time the corresponding
function is called to change a utf8-encoded string's case.  If a 
corresponding C<To-> function has been defined in the package
making that first call, the mapping defined by that function will be the
mapping used for the duration of the program's execution across all
packages and scopes.  If no corresponding C<To-> function has been
defined in that package, the standard official mapping will be used for
all packages and scopes, ignoring any corresponding C<To-> function
anywhere."

So what would a sane behavior look like that didn't break backwards 
compatibility too much?


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