On Fri, Jul 22, 2005 at 03:40:34PM -0700, Larry Wall wrote:
> I dunno.  I'm inclined to say that it should default to Item|Pair, and
> let people say Any explicitly if they really want to suppress autothreading.
> Otherwise conditionals and switches are going to behave oddly in the
> presence of "accidental" junctions.

Okay.  However, in that view, I suspect many builtins will be defined on
Item|Pair, for example &perl, &clone, &id, as well as various coercion
builtins.  Considering that builtins are Code objects but not Routines,
maybe they, too, should default to Item|Pair -- except the ones that
operates on junctions, of course.

This leads me to think that maybe users don't really need to write down
the two junctive types, under the hierarchy below:

    - Object
        - Any
            - Item
                - ...pretty much everything
            - Pair
        - Junction
    - num, int, str...

Since junctions are still boxed objects, having the Object type to
effectively mean Any|Junction seems natural ("everything is an object").

Also, since Any unifies Item and Pair, the rule for implicit types of
argument becomes:

    sub ($x) { }    # Item $x
    -> $x { }       # Any $x    - i.e. Item|Pair but not Junction
    { $^x }         # Any $x    - i.e. Item|Pair but not Junction

Does this sound sane?


Attachment: pgpbsmHzHG4yc.pgp
Description: PGP signature

Reply via email to