Okay, I think this is worth bringing up to the top level.
Fact: Captures seem to be turning into a first-class data structure
that can represent:
argument lists
match results
XML nodes
anything that requires all of $, @, and % bits.
Fact: We're currently going through contortions to try to get these to behave
when they're stored in a scalar variable: [,] =$capture
Fact: This contrasts with the ease with which we can request arrayness
and hashness using the @ and % sigils.
Conjecture: We need a corresponding sigil to request captureness.
As with @ and %, you can store a capture in a $ to hide it, but we
don't have the ability to have capture variables that know how to
behave like captures without fakey syntactic help.
Bikeshed: What should that sigil be? And if it's in Latin-1, what's the
ASCII workaround?
Latin-1 candiates:
¡ 00A1 INVERTED EXCLAMATION MARK
¢ 00A2 CENT SIGN
£ 00A3 POUND SIGN
¤ 00A4 CURRENCY SIGN
¥ 00A5 YEN SIGN
¦ 00A6 BROKEN BAR
§ 00A7 SECTION SIGN
¨ 00A8 DIAERESIS
© 00A9 COPYRIGHT SIGN
ª 00AA FEMININE ORDINAL INDICATOR
« 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
¬ 00AC NOT SIGN
00AD SOFT HYPHEN
® 00AE REGISTERED SIGN
¯ 00AF MACRON
° 00B0 DEGREE SIGN
± 00B1 PLUS-MINUS SIGN
² 00B2 SUPERSCRIPT TWO
³ 00B3 SUPERSCRIPT THREE
´ 00B4 ACUTE ACCENT
µ 00B5 MICRO SIGN
¶ 00B6 PILCROW SIGN
The obvious ASCII for ¢ would be c/ or C/ or c| or c| or maybe just |.
The obvious ASCII for © would be (c), I suppose.
Or instead of going for visual lookalikes, we could go for semantic
likenesses. If @@ is multiple arrays, then @% or %@ could be an array
mixed with a hash (and a scalar, but let's not go that far). Which
leads me to wonder if there's a Latin-1 synonym for @@, like § maybe
for "sectional", or µ for "multidimensional", or ® for, er, repetitious
or something.
Hmm, then ®©foo could take the multidimensional feeds out of capture
"foo". Maybe µ¢foo looks better though. Or maybe we could work
the € in there somewhere for "extra" dimensional... ☺
On the other hand, we could just make |foo a capture because it
inclusive-ORs several other structures. Main downside is that it looks
too much like an "ell". That's probably not a showstopper in practice.
Much of the time we'd be using it to qualify other variables anyway, so
instead of scattering [,] all over the place we would have things like
foo(|$foo)
foo(|@foo)
foo(|%foo)
foo(|foo)
Visually it kinda works as an "insert this here" marker too. And most
of the places you'd use it wouldn't be using | operators. Another factor
is that it kind of resonates visually with the \ that makes captures.
Larry