develooper Front page | perl.perl6.language | Postings from July 2005

Re: Elimination of Item|Pair and Any|Junction

Thread Previous | Thread Next
From:
Matt Fowles
Date:
July 27, 2005 09:19
Subject:
Re: Elimination of Item|Pair and Any|Junction
Message ID:
f2601a7f05072709191236b60d@mail.gmail.com
Larry~

On 7/27/05, Larry Wall <larry@wall.org> wrote:
> 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].

While we are talking about words... I dislike having Object encompass
Juction.  I get the feeling that some people will write functions that
take Objects and not expect Junctions to slip in.  I suppose that
could be one of those hurdles that developers just have to jump, but
it doesn't feel like it should be.

Matt
-- 
"Computer Science is merely the post-Turing Decline of Formal Systems Theory."
-Stan Kelly-Bootle, The Devil's DP Dictionary

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About