On Thu, 17 Oct 2002, Adam D. Lopresto wrote:
: Then again, it always seemed odd that you combine two flags with | to turn them both
: on).  There could probably be a bitwise type that would overload superpositions
: to do bitwise math instead...
: 
: my Bitwise $a = 1;  #woohoo, $a and $b are no longer magical!
: my Bitwise $b = 3;
: 
: print $a & $b;      #prints 3
: 
: So if you really need to do a lot of bitmath, you use the special types, and
: otherwise you can be barely aware that they exist.

Yeah, I've been thinking about that approach for several days now.
The main problem I see with it is that sometimes you want to view
an integer as a superposition, and sometimes not.  Someone might be
surprised when they use $b in a case and discover it's matching 1|2
rather than 3.

: sysopen($handle, $filenmae, O_CREAT & O_RDRW);

Nothing says that actually has to do bit math!  This could also be
made to work:

    sysopen($handle, $filenmae, "create" & "rdrw");

Could even make something like this work:

    sysopen($handle, $filenmae, "exists" & "append"
                              | "create" & "rdrw");

One could go as far as to make a superposition of lvalues do unification.

But I think we need to keep superpositions separate from bitops because of
the and/or confusion you noted.

Larry

Reply via email to