On Tue, 29 Oct 2002, Austin Hastings wrote: : --- Piers Cawley <[EMAIL PROTECTED]> wrote: : > >> : > >> one(any($a, $b, $c), all($d, $e, $f)) : > >> : > >> Is a good deal more intention revealing than the superficially : > >> appealing than : > >> : > >> ($a & $b & $c) ^ ( $d | $e | $f )
First I would like to point out that the & and | are backwards there from the original. & means all(), and | means any(). : Would it be practical/meaningful to say : : $result = bitwise ($a & $b & $c) ^ ($d | $e | $f); : $result = superpose ($a & $b & $c) ^ ($d | $e | $f); : : And allow a use operation to select defaulting behavior? (With an : appropriate warning if the code used one of these operators without : specifying the use directive, even though <crab-style> is the default?) All other things being equal, I think people will find modal operators more confusing than if we just make separate operators. That being said, I'm still wondering whether we can finesse it. Damian's default any() semantics in numeric context select a random element. If we made that not the default, we could have an alternate default semantics in numeric (or, at least, integer) context. So suppose we introduce for the "pick one" semantics an explicit verb named, oddly enough, pick(). my int $foo = pick( 1 | 2 | 4 ); # $foo gets (1,2,4)[rand 3] my int $bar = 1 | 2 | 4; # $bar gets 7 People can be scared if they like, but I am also of the opinion that superpositions are more "basic" than bitops, at least in a sense. My reasoning for that is that they don't commit to an interpretation prematurely. A 1 | 2 | 4 means "a 1, a 2, or a 4", nothing more. You can make other things out of a superposition depending on the context. Damian already made them mean two different things in numeric vs string context. We could possibly make them mean more things. So I wonder about whether, in $result = superpose ($a & $b & $c) ^ ($d | $e | $f); the "superpose" is really a no-op. If you go on to say my int $foo = pick( $result ); # random element filling "contract" my int $bar = $result; # bitwise then the superposition would collapses as specified. There is one little difficulty with this approach, though. It would have to retroactively change the meaning of non-powers-of-two. That is, if you say $mask = 7; $somebits = 1 | 2; my int $foo = $somebits & $mask; then at the point of wave-function collapse, the 7 from $mask has to be re-interpreted as a 1|2|4. Maybe that's okay, and maybe it isn't. >From a transactional view of QM, it's probably fine, since that view allows for sending information back through time to entangled partners. It's also fine from a tagmemics point of view, I think, since context can change the meaning of both nouns and verbs. Actually, I suppose that in contrast to int context, num context could pick() by default. And str context could do strbitops. Or it could do the currently specified str default of listing out the whole shebang. That's probably more user-friendly when you print out error messages, so I expect stringwise bitop collapse would have to be requested explicitly. Or we need to have a bitstring type, or some such. There are other places where distinguishing data strings from human-readable strings would be useful. Larry