On Fri, Feb 04, 2005 at 04:09:03AM +0800, Autrijus Tang wrote: > Okay. So "Egg" is the value type for elements in @carton. But what > is the implementation type of @carton? > > my @carton of Egg is Scalar; # is @carton Scalar? > my @carton of Egg is Array; # is @carton Array? > > S06 does not cover this point, which leads to a very bad case of > ambiguity. Below I will show that both interpretation are troublesome.
Thanks to Jonathan Scott Duff's off-list hint, A06 did show that the second model is more correct. That's what I get from basically ignoring the Apocalypses during implementation. :-/ I stand corrected. Won't do that again. Attached is the patch to S06.pod that adds the two bits of information I'd like to see. The $dog typo has been fixed a week ago. However, I'd still like to know whether my understanding on punning (same class 'Array' used as both Implementation Type and Value Type) and the validity of matching on "$var is TraitName" in subroutine signatures is correct. That, and types of hash keys. :) Thanks, /Autrijus/ --- S06.pod.orig Fri Feb 4 04:29:34 2005 +++ S06.pod Fri Feb 4 04:29:07 2005 @@ -650,6 +650,7 @@ Class Perl 6 standard class namespace Object Perl 6 object Grammar Perl 6 pattern matching namespace + Pair Perl pair List Perl list Lazy Lazily evaluated Perl list Eager Non-lazily evaluated Perl list @@ -685,6 +686,7 @@ The implementation type specifies how the variable itself is implemented. It is given as a trait of the variable: + my @carton is Array; # this is the default my $spot is Scalar; # this is the default my $spot is PersistentScalar; my $spot is DataBase;
pgphVVFZmNiwL.pgp
Description: PGP signature