perl-unicode

Re: Unicode aware module

1999-04-23 13:00:02
At 12:00 PM 4/23/99 , Graham Barr wrote:
sub abc : utf8 {
}

sub abc : ascii {
}

sub abc {
}

could be allowed such that the utf8 sub is only called when utf8 is in
effect, the ascii (or byte whatever) is called when we are in that mode
(which currently is when we are not in utf8 mode) and the last would be
called for any other utf8-like pragma, say if we had utf16 in effect.

Now we cannot store these in the symbol table as we cannot have multiple
subs by the same name, but we could mangle the name, eg

 sub abc : utf8    => abc__utf8 or __utf8_abc

and have a flag on the abc sub to say we have such subs. Then when the
compiler is doing a lookup it would first lookup abc, if that had the
hint bit set it would look for the sub for the current mode. If that
cannot be found it would use abc

What about a way of being able to define a sub so that it inherits the
flags of the caller?
If a module works with characters, then it will not care what mode it is
in, it just wants to be in the mode of the caller.

<Prev in Thread] Current Thread [Next in Thread>