Re: Retry: ITypes and VTypes.

2005-02-06 Thread Luke Palmer
Brent 'Dax' Royal-Gordon writes: > Alexey Trofimenko <[EMAIL PROTECTED]> wrote: > >my $var = "test"; > >my @arr := $var; > > error? or maybe it would be the same weirdness, like in former example? or > > maybe it's a ["test"]? > > The := operator uses the same rules as parameter passing.

Re: Retry: ITypes and VTypes.

2005-02-05 Thread Brent 'Dax' Royal-Gordon
Alexey Trofimenko <[EMAIL PROTECTED]> wrote: >my $var = "test"; >my @arr := $var; > error? or maybe it would be the same weirdness, like in former example? or > maybe it's a ["test"]? The := operator uses the same rules as parameter passing. So, what do you think this does? sub foo(@

Re: Retry: ITypes and VTypes.

2005-02-05 Thread Alexey Trofimenko
On Fri, 4 Feb 2005 04:09:03 +0800, Autrijus Tang <[EMAIL PROTECTED]> wrote: ... Let's take the first one first, because it is what S06 seems to imply, although it is against Perl5's tie() intuition: my @carton is Scalar; # assuming this is the default Now @carton implements the

Re: Retry: ITypes and VTypes.

2005-02-04 Thread Miroslav Silovic
[EMAIL PROTECTED] wrote: However, I wonder how to talk about an array that can contain elements of any value type, but all the elements must have the same type. Is Perl6 capable of expressing such a restraint? Thanks, /Autrijus/ The problem (in general) with this requirement is that it conflicts

Re: Retry: ITypes and VTypes.

2005-02-04 Thread Autrijus Tang
On Fri, Feb 04, 2005 at 01:00:33PM +0100, Miroslav Silovic wrote: > The problem (in general) with this requirement is that it conflicts with > inhericance. Perl6 allows you to extend any type (using 'but' operator, > for example) and so, any time you promise that something will be of a > certain

Re: Retry: ITypes and VTypes.

2005-02-04 Thread Autrijus Tang
On Fri, Feb 04, 2005 at 06:04:52PM +0800, Autrijus Tang wrote: > my @array of Array; > my @array is Array of (Any is Array of (Any is Scalar)) > > If so, may I consider it as equivalent to this Haskell code? > > class TArray baseVtype elemVtype where {- ... -} -- Array Trait > cla

Re: Retry: ITypes and VTypes.

2005-02-04 Thread Autrijus Tang
On Thu, Feb 03, 2005 at 03:59:06PM -0800, Brent 'Dax' Royal-Gordon wrote: > Autrijus Tang <[EMAIL PROTECTED]> wrote: > > 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 "

Re: Retry: ITypes and VTypes.

2005-02-03 Thread Brent 'Dax' Royal-Gordon
Autrijus Tang <[EMAIL PROTECTED]> wrote: > 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

Re: Retry: ITypes and VTypes.

2005-02-03 Thread Autrijus Tang
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 Arr

Retry: ITypes and VTypes.

2005-02-03 Thread Autrijus Tang
Sorry for the last thread. Please let it die off. Let me restart the thread, asking the same question, hopefully making more sense this time. I promise to write in concrete Perl6, instead of Compiler Speak. Really. In Synopsis 6 version 6, "Value types" section: my Dog $spot; my $spo