On Fri, Oct 11, 2002 at 03:21:38PM +0100, Aaron Crane wrote:
> Vaguely heretical, I know, but I'd be inclined to do something like this:
>
> Perl 5 Proposed Perl 6
> $x && $y $x & $y
> $x || $y $x | $y
Larry just added nice character doubling ops to be more consistent and
here you want to take two of them away? :-)
> $x & $y bitand($x, $y)
> $x | $y bitor($x, $y)
>
> Using functions instead of operators for these operations seems reasonable
> to me given how often they're useful.
How about these?
$x band $y
$x bor $y
Of course, then people will probably expect these too:
$x bshl $y
$x bshr $y
$x bxor $y
Hrm ...
sysopen(FOO,"foo", O_WRONLY bor O_CREAT bor O_TEXT)
sysopen(FOO,"foo", bor O_WRONLY, O_CREAT, O_TEXT)
:-(
As long as we're in fantasy-land, how about these?
$x .& $y
$x .| $y
Those look like bit operations to me :-)
> I'm not especially fond of the names bitand and bitor, but they're
> accurate, reasonably short, and have prior art in C and C++.
Not all prior art is necessarily good art :-)
> Two things about this proposal:
>
> * This leaves && and || available for other purposes, but I can't
> off the top of my head think of anything else I'd want them for.
Then why muck with them? Just munge the bitwise operators.
> * Does this make it harder to write overloaded bitwise ops for your
> classes?
No harder than it was before especially given that you can warp the
syntax however you please.
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]