On Wed, 30 Oct 2002, Austin Hastings wrote:
: >    [op]  - as prefix to any unary/binary operator, "vectorizes" the 
: > operator
: 
: What, if any, guarantees are there about the order of evaluation for
: vectorized operations?
: 
: If I say
: 
: @b = @a[.meth];
: 
: and .meth has a side-effect, what can I expect?

Well, that's just a subscript, not a hyper.  But if it were a hyper, and
if it had side effects, I'd say your program was erroneous, in Ada parlance.

: >     ?&      ?|      ?^              - [maybe] C-like bool operations
: >     ?&=     ?|=     ?^=             - (result is always just 1 or 0)
: >    [?&]    [?|]    [?^]             - (hyperversions)
: >    [?&]=   [?|]=   [?^]=
: >    [?&=]   [?|=]   [?^=]
: 
: Two possible differences between double-[&|] and single-[&|]:
: 
: 1- Force (unlazy) evaluation of all operands.
: 2- Force conversion to 1 or 0.

It should do just what the corresponding basic operator would do between
two scalars.

: (Are "true" and "false" going to be built-in literals, a la java?)

Never.  Truth is relative in Perl.  Having a "true" literal would
imply that objects couldn't decide whether they're true or not, unless
the true literal really means a superposition of all the possible
true values of every type.  Which is kinda hard to write, especially
since a type could decide on the fly whether a value is true.

: Which (or both) of these are supposed to come from the single-op
: versions of these?
: 
: >     &       |       ^          - superpositional operations
: >     &=      |=      ^=         - conjunctive, disjunctive, exclusive
: 
: What's the precedence for these? Same as C?

No, the bare ones are tighter than comparisons.  All assignment ops are the
precedence of assignment, though.

: If so, what happens when you combine them? Are they associative,
: distributive, worse?

I don't think those terms apply till you collapse.

: Since the flexprs haven't collapsed, what interactions are there when
: "appending" to them?

I dislike the term "flexprs" even though it's kinda cute.  I don't
think it communicates what's really going on any better than
"superpositions".  Druther call them something ugly like "junctions"
if that communicates better.

Maybe it could be "junks" for short.  So you'd read

    $a ~~ 1|2|3

as "Does $a match this junk?"

: $a = 1 | 5;
: $a &= 10;
: 
: What's $a?
: 
: 1 | 5 & 10
: (1|5) & 10
: (1&10) | (5&10) ?

The second, if any.  But maybe it should be a no-no to append to a
junk of a different kind.  We've already said that appending to a
junk of the same type doesn't add "parentheses".  This may be one
of those situations where the assignment operators are overloaded
separately from the basic ops.

: This is probably my ignorance of this coming through. Maybe I need to
: get more presents this Christmas ... :-(
: 
: On the other hand, some of the examples seem counterintuitive. That is,
: considering Damian's:
: 
: $seen = $start | $finish;
: for ... -> $line {
:   print "$line\n" unless $line == $seen;
:   $seen |= $line;
: }
: 
: I can understand the notion of "unless $line is a-or-b-or-c-or..." but
: I keep THINKING in terms of "I've seen a-and-b-and-c-and..."
: 
: So when would multiple flexops be combined? Anyone have any real world
: examples, even simple ones?

I dunno, don't look at me.  I'm afraid most of the complicated examples
so far fail the bear-of-very-little-brain test.  I would like mere mortals
to be able to understand Perl code in general...

Larry

Reply via email to