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

Re: Behavior of bitwise ops on unencountered wide characters

Thread Previous | Thread Next
From:
Father Chrysostomos
Date:
July 12, 2017 17:43
Subject:
Re: Behavior of bitwise ops on unencountered wide characters
Message ID:
20170712174311.29109.qmail@lists-nntp.develooper.com
Karl Williamson wrote:
> It would be good to have some alternative that requires only a cheaply
> loaded, or internal module, something named like "Internals" that
> provides a clear access path for the things we have determined warrant
> it, such as Graham's use case.  He had to explain to me how it worked,
> and he had to explain to Yves as well.  That demonstrates is is
> non-obvious.  When the tools aren't available, people will do clever,
> but non-maintainable things to get what they need.  But it is best to
> furnish the tools when it becomes known that they would be useful.

What worries me is that as soon as we have a blessed way of determin-
ing whether an argument is internally a number, we will end up with
code that does this:

  sub foo {
      croak ("Argument is not a number") unless Internals'is_num $_[0];
      ...
  }

and then such code stops working with quoted numbers and over-
loaded objects.

If we do add such a feature, please leave it undocumented, or annotate
the documentation with warnings that the feature is intended solely
for serialization, etc., and that using it to validate arguments (or,
worse, determine dispatch) goes against the spirit of Perl.

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