Larry Wall schreef:
> Dr.Ruud:

>> What would be the way to define-or-set that a specific hash has
>> non-case-sensitive keys?
>
> Use a shaped hash with a key type that defines infix:<===>
> appropriately, since object hashes are based on infix:<===> rather
> than infix:<eq>.

Suppose I want the keys to be Normalization-Form-C, and the values to be
regexes,
would this be the way to say that?

  my Regex %hash{ NFC } ;

http://www.unicode.org/notes/tn5/
http://icu.sourceforge.net/
http://www.ibm.com/software/globalization/icu/


>> Or broader: that the keys should be normalized (think NFKC()) before
>> usage?
>
> I think it would be up to the type to generate, transform to and/or
> cache such a canonicalized key.

OK, alternatively "delegate it to the type".


>> Would it be easy to "delegate it to the hash"? (or use a hardly
>> noticeable wrapper)
>
> Probably--just give the hash a shape with a key type that is easily
> coerced from the input types, I suspect.  Hash keys could probably
> afford to do an implicit .as(KeyType) even if the current language
> were to disallow implicit conversions in general.

Maybe not hash keys in general, but only hash keys of a type that needs
it. But wait, even stringification is coercion.

-- 
Affijn, Ruud

"Gewoon is een tijger."


Reply via email to