There have been several suggestions and RFCs to consider implementing
stronger typing -- C<my int $i;> -- and attributes --  C<my $i
:integer;> -- for Perl.

Should we consider revisiting how current perl handles bit operations
on numbers, ie, based on the C<use integer;> pragma?

>From perlop:
---
Used on numbers, the bitwise operators ("&", "|", "^", "~", "<<",
and ">>") always produce integral results.  (But see also the
Bitwise String Operators entry elsewhere in this document.) 
However, `use integer' still has meaning for them.  By default,
their results are interpreted as unsigned integers, but if `use
integer' is in effect, their results are interpreted as signed integers.  
For example, `~0' usually evaluates to a large integral value. 
However,  `use integer; ~0' is `-1' on twos-complement machines. 
---

The implementation is documented and is understandable, but is arguably
not readily apparent.  (After all, bitwise operators already produce,
as it states above, integral results - it seems slightly confusing and
counter-intuitive to apply an integer pragma and have it potentially
alter the outcome.)

In some cases, this extends beyond simple reporting of the number as
signed or unsigned - it alters the behavior of the right shift (on some
platforms?) 

Attribute?  :signed, :unsigned, plus whatever additions allow you to set
and query attributes?

Typing?  unsigned int, signed int, plus whatever additions allow you to
cast types?

New keywords?  int() and uint(), for example?

New operator for right-shifting (sign-bit propagation)? >>>?

Stay the course?

 -- 
Bryan C. Warnock
([EMAIL PROTECTED])

Reply via email to