On Wed, Apr 20, 2005 at 11:28:23PM +0200, Juerd wrote:
: Autrijus asked me to summarize here what I said on IRC #perl6, and ask
: Larry for another "that's all correct".
: 
: I've rephrased everything as facts/assumptions.
: 
: Array context, as provided by a signature of "Array $foo", is still
: a form of scalar context, even though Array.isa(List).

I don't think Array.isa(List).  I think List.isa(Array of Generator),
and Array.maybehasa(List) stored under it's .specs property for generating
more values of the Array if you run off the end of the existing elements.

:     Array is a class here.

Yes.

:     Classes when used for context expect objects.

If by "context" you mean variable declaration, then yes.

:     Objects are references.

Objects are blessed referents, just as in Perl 5.  It's just that most
such referents are an opaque type now.  I think what you're trying
to say here is that Real Objectsâ are never value types, which is true.
Objects are always accessed through references, as in Perl 5.

:     Array implies ref.

Yes, though people don't have to realize that when they say @foo[$bar].

:     The main contexts, void, scalar and list, have nothing to do with
:     types.

That's a slight overstatement, but mostly true.

:     Scalar context can expect a certain type of value, for example, an
:     Array or a Dog.

Yes.

:     List context can also expect a certain type of values for its
:     elements.

Right.

: Somewhere during our conversation, I suggested renaming scalar and list
: context to singular and plural context, to avoid all the confusion.

I often talk about them in those terms, but I'd hate to have to type
"singular" instead of "scalar" or "plural" instead of "list" all the time.

: Void context still exists and is not a form of singular or plural
: context. Perhaps this should be called nullar context, although void
: context works equally well for me and is not confusing because we have
: no Void type.

So let's get just rid of Scalar and List types.

: When we really want a scalar (the thing itself), we call that Any
: context or Scalar context, both forms of singular context (formerly
: called scalar context).
: 
: What exactly is the difference between Scalar and Any?

Isn't any, that I can tell.  So maybe we settle on Any for the type
and scalar() for the function/concept.  It'd be nice if we could
unify those somehow, but any() is taken.  Maybe Item/item().

Likewise, there's really no such thing as a List.  The basic list types
are actually Eager and Lazy, and an Array conveniently contains one of each.

Larry

Reply via email to