Re: \p{IsBogus} vs. exception

[email protected] (Dan Kogai)
Newsgroups perl.unicode,perl.perl5.porters
Message-ID <[email protected]>
On Mar 07, 2006, at 01:45 , Yitzchak Scott-Thoennes wrote:
> So the property is only checked for validity at the point when it is
> actually used.  I'm not sure it would even be desirable to check it
> before then (that is, at regcomp-time), remembering that Perl is a
> dynamic language.

Maybe too dynamic :)  Not many people would expect \p{IsBogus} is  
completely ignored where.

'str' =~ / \p{IsBogus}/;

But in cases like

   $str = $ARGV[0];
   $str =~ / \p{IsBogus}/;

the code may or may not raise an exception and that's somewhat tricky.

On Mar 07, 2006, at 01:45 , [email protected] wrote:
> This all looks perfectly consistent to me: the expensive work of
> looking up the property is not done until matching actually gets
> to that point.

Thanks.  Sounds reasonable to me, too.

> I would not call this a bug (not sure if you were suggesting that it
> is) - if you need to check whether a property is bogus, your example
> has_unicode_property is fine. But it would not be unreasonable for
> utf8.pm (or something) to provide a function that delivers the same
> information.

I agree.

Dan the Perl5 Porter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.