All the Perl that's Practical to Extract and Report

Navigation

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

On Wed, Apr 20, 2005 at 10:23:14PM +0200, Juerd wrote:: Autrijus Tang skribis 2005-04-21 4:19 (+0800):: > So, following up on the Parens handling, are these two equivalent?: > # Assuming &is has the parameter signature (Str, Str, Str): > is((1,2), (3,4), "hey");: > is([1,2], [3,4], "hey");:: I think so.:: > What happens if &is is of type (Any, Any, Str)?:: Same thing, as the inner comma is still in scalar context.:: However, with list context, I expect things to flatten, so with a: signature of *@_, it puts 5 elements in @_.

That's all correct.

Larry

We continued on IRC: (the time difference is caused by my driving home)

23:08 < Juerd> autrijus: I eventually guessed correctly!;)23:10 < autrijus> gah.23:10 < autrijus> Juerd: you are correct after all.23:10 < autrijus> Juerd: so if &is is of signature (Array, Array, Str)23:11 < autrijus> (all three nonslurpy)23:11 < autrijus> Juerd: is the inner (1,2) still running in scalar context?23:11 < autrijus> Juerd: or are the suddenly in Array context?23:11 < Juerd> autrijus: Then it's still scalar context (specifically, arraycontext, which surprisingly nicely is not a form of list context):)23:11 < Juerd> autrijus: Array context is a scalar context23:11 < autrijus> Juerd: that is hard to believe.23:12 < autrijus> Juerd: I can see "array ref" context, maybe23:12 < Juerd> I think we should rename scalar context to singular context23:12 < autrijus> Juerd: but Array is a List23:12 < autrijus> as Hash is a List23:12 < Juerd> autrijus: Array is a class, classes when used for context expectobjects, objects are references, Array implies ref23:12 < Juerd> autrijus: That may be, but types have nothing to do withcontext.23:12 < autrijus> Juerd: wow. that line is the most clear thing I have read.23:13 < autrijus> Juerd: it also invalidates my hope to release 6.2.1 tonight:-(23:13 < autrijus> Juerd: since that means my Eval.hs comma implementation isAll Wrong.23:13 < Juerd> autrijus: I think it'd be good to rename scalar and list contextto singular and plural context, to avoid confusion with types.23:13 < autrijus> Juerd: so, it has nothing to do with types, right?23:13 < autrijus> it's either singular, or plural23:14 < autrijus> literal lists always flatten in plural context23:14 < autrijus> and never flatten in singular context23:14 < autrijus> singular context may be further limited in expecting specificobject types23:14 < Juerd> autrijus: The main contexts have nothing to do with types,except that scalar(singular) context can expect a certain type of singularvalue, for example, an Array (reference)23:14 < autrijus> while plural context does not care about type23:14 < Juerd> autrijus: Exactly23:14 < autrijus> is that the case?23:15 < Juerd> autrijus: Plural context can care about the types of its values23:15 < autrijus> Juerd: I wish these lines are in the synopsis!23:15 < autrijus> Juerd: can you be kind and summarize these line into a replyon p6l to my thread?23:15 < autrijus> and get another "That's all correct" from Larry23:16 < autrijus> so, sorry, folks, no 6.2.1 tonight because the new contexthandling is all wrong:-/23:16 < Juerd> autrijus: Which lines precisely?23:16 < autrijus> Juerd: everything after23:16 < autrijus> 05:08 < autrijus> Juerd: you are correct after all.23:16 < Juerd> autrijus: That's a lot.23:16 < autrijus> Juerd: well, what you said, anyway23:16 < autrijus> I'd do that, but it's 5:14am here and my fingers are onstrike:)23:16 < Juerd> I'll see if I can make a nice bulleted list23:17 < autrijus> thank you23:17 < autrijus> Juerd++23:19 < autrijus> is Void a special subtype of Singular, then?23:19 < autrijus> or is Void a context of its own like in p5?23:21 < autrijus> Nullar23:21 < autrijus> I'll need to sleep on this new revelation.23:21 < gaal> (i've seen "nullary" mentioned in some haskell texts, no doubt indifferent, er, contexts)23:22 < autrijus> gaal: it's used in arity context, so "unary" instead of"singular"23:22 < gaal> ah. the *opposite* of context.23:22 < gaal> (in a way.)23:23 < autrijus>:)23:23 * autrijus waves... I'll be back:)23:23 < gaal> night!23:23 < autrijus> see you tomorrow, folks23:23 < autrijus> night!23:23 < autrijus> &23:27 < Juerd> autrijus: I'd think void context would not be Void context, asyou cannot have a reference to nothing, or express nothingness in a variable(we have undef), or meaningfully force void context in an expression

See also the related thread "Quick question: parens vs subroutine parameter" in the perl6-language mailinglist.