CARVIEW |
Select Language
HTTP/2 200
cache-control: max-age=43200
server: Combust/Plack (Perl)
vary: Accept-Encoding
content-encoding: gzip
content-length: 1954
content-type: text/html; charset=utf-8
last-modified: Tue, 14 Oct 2025 01:21:02 GMT
date: Tue, 14 Oct 2025 01:21:02 GMT
strict-transport-security: max-age=15768000
[perl #123466] Overloading for number-specific bitwise ops - nntp.perl.org
Front page | perl.perl5.porters |
Postings from January 2015
nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About

[perl #123466] Overloading for number-specific bitwise ops
Thread NextFrom:
Father Chrysostomos via RTDate:
January 4, 2015 22:40Subject:
[perl #123466] Overloading for number-specific bitwise opsMessage ID:
rt-4.0.18-15452-1420411213-496.123466-15-0@perl.orgHow should ‘&’ overloading work in the presence of the ‘bitwise’ feature? Up till now it has been up to the overload implementation to decide whether & and | should have stringy or numeric behaviour. But under the ‘bitwise’ feature it is the caller that decides. So, under that feature, should we use the existing overload types (& | ^ ~) for the numeric ops? Or should we introduce a new set of number-specific overload types that those ops trigger under the feature? (I plan to introduce new overload types for the string-specific ops either way, since they are brand new operators [&. |. ^. ~.].) In the first case, object implementations that want to know whether the caller specifically requested numeric behaviour will have to look at feature hints. For warnings, we provide warnings::enabled, but feature.pm provides no such interface. Should it? (I don’t like the idea of adding it, because I prefer to think of feature.pm as a back-end for ‘use v5.xx’ and experimental.pm. And whether a particular language feature has anything to do with feature.pm may be subject to change.) In the second case, it might be confusing to have a separate num& overload type; even if it is not confusing, it is a bit clunky. Does anybody currently overload & | ^ ~ for non-numeric uses? The only use of these I am aware of is by modules like Math::BigInt, etc. What I would like to do is just use & for &, leave feature.pm alone, and recommend that & overloads be number-specific regardless of perl version. That seems the simplest and most straightforward approach overall. -- Father Chrysostomos --- via perlbug: queue: perl5 status: open https://rt.perl.org/Ticket/Display.html?id=123466Thread Next
- [perl #123466] Overloading for number-specific bitwise ops by Father Chrysostomos via RT
- Re: [perl #123466] Overloading for number-specific bitwise ops by Aristotle Pagaltzis
- Re: [perl #123466] Overloading for number-specific bitwise ops by Father Chrysostomos via RT
- Re: [perl #123466] Overloading for number-specific bitwise ops by Ricardo Signes
- Re: [perl #123466] Overloading for number-specific bitwise ops by Aristotle Pagaltzis
- Re: [perl #123466] Overloading for number-specific bitwise ops by Ricardo Signes
- Re: [perl #123466] Overloading for number-specific bitwise ops by Father Chrysostomos via RT
- Re: [perl #123466] Overloading for number-specific bitwise ops by Ricardo Signes
nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About