On Wed, Jul 27, 2005 at 08:01:25PM +0800, Autrijus Tang wrote: : 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?
Yes. The only thing I don't like about it is that any() isn't an Any. Maybe we should rename Any to Atom. Then maybe swap Item with Atom, since in colloquial English you can say "that pair of people are an item." That would give us: - Object - Item - Atom - ...pretty much everything - Pair - Junction - num, int, str... which nicely distinguishes Item from Junction. On the other hand, I actually kinda dislike the word "Atom" for common use (too much exposure to Lisp, I guess), so maybe we just want - Object - Mumble - Item - ...pretty much everything - Pair - Junction - num, int, str... where Mumble is something like Atom/NonJunction/Unit/Scalar/[your ad here]. Larry