Larry Wall wrote:
On Wed, Jul 27, 2005 at 06:28:22PM +0200, "TSa (Thomas Sandlaß)" wrote:
: Since we are in type hierachies these days, here's my from ::Any
: towards ::All version.

That's pretty, but if you don't move Junction upward, you haven't
really addressed the question Autrijus is asking.  We're looking
for a simple type name that means none(Junction) for use as the
default type of the $x parameter to -> $x {...}.  Whatever we call
it, this type/class/role/subtype has to admit Item and Pair objects
but not Junctions.  (And if that's the wrong way to think about it,
please tell us why.)

Sorry, here's the patch:

              :   &Code     @Array   %Hash     $Item
              :     |         /        /         |
  with        :     |       Tuple    Record      |
  invocant(s) :     |                            |
          ____:____/ \______              _______|_________
         |    :  |     |    \            |    |     |      |
      .Method : Sub  Block   |        Value  Inf  Undef  Junction
        /|    :  |\          |           |
       / |    :  | \        Ref[Code]    |
   Rule  |    :  |  Macro                |
         |____:_/|            __________/|\___________
         |    :  |           |     |     |     |      |
       Multi  :  |         ~Str  +Num  \Ref  :Pair  /Match/

Now the Junction is nicely constraint with the upper bound Item (less specific) and a lower bound Value (more specific). This also reads
nice if you want to (explicitly) allow both:

 sub ( Value|Junction $val_junc )

What sub ( $any ) should default to, I don't know. My $Item indicates
Item, but could also be $Value. Or unspecific $(Item|Value).
--
$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to