Re: some questions about S02(type)

2009-04-06 Thread Darren Duncan
Timothy S. Nelson wrote: On Sat, 4 Apr 2009, Darren Duncan wrote: Speaking of libraries, I already implemented a table type ... it's called Set::Relation/::V2 and its on CPAN right now ... for Perl 5 ... I still have to port it to Perl 6, unless someone else wants to do that, but I designed

Re: some questions about S02(type)

2009-04-06 Thread Darren Duncan
Xiao Yafeng wrote: I don't think an array of hashes and a hash of arrays could perfectly represent a Table type. There are several important facts of a relational model:unordered columns and tupples, various constraints on columns. E.g. how can we represent multi-unique constraints as an array

Re: some questions about S02(type)

2009-04-05 Thread Xiao Yafeng
I don't think an array of hashes and a hash of arrays could perfectly represent a Table type. There are several important facts of a relational model:unordered columns and tupples, various constraints on columns. E.g. how can we represent multi-unique constraints as an array of hashes? On

Re: some questions about S02(type)

2009-04-05 Thread Timothy S. Nelson
On Sat, 4 Apr 2009, Darren Duncan wrote: Speaking of libraries, I already implemented a table type ... it's called Set::Relation/::V2 and its on CPAN right now ... for Perl 5 ... I still have to port it to Perl 6, unless someone else wants to do that, but I designed it so that would be easy

Re: some questions about S02(type)

2009-04-04 Thread Xiao Yafeng
On Fri, Apr 3, 2009 at 10:52 PM, Moritz Lenz mor...@faui2k3.org wrote: Xiao Yafeng wrote: 1. Could I set multi-return type?like sub test as (Int, Str) {...} as is coercion - so to what would it coerce? Int or Str? How could the compiler know? Or do you mean

Re: some questions about S02(type)

2009-04-04 Thread Timothy S. Nelson
On Sat, 4 Apr 2009, Xiao Yafeng wrote: 3. Could I define primary key for a bag variable? All items in a Bag are primary keys, but there's no data additional data associated with it. I mean whether I can see Set as a table and Bag as a table with a unique constraint? like: subset

Re: some questions about S02(type)

2009-04-04 Thread Darren Duncan
Timothy S. Nelson wrote: On Sat, 4 Apr 2009, Xiao Yafeng wrote: I mean whether I can see Set as a table and Bag as a table with a unique constraint? like: I think you have that backwards. A Set is conceptually like a Bag with a uniqueness constraint, not the other way around.

Re: some questions about S02(type)

2009-04-03 Thread Moritz Lenz
Xiao Yafeng wrote: 1. Could I set multi-return type?like sub test as (Int, Str) {...} as is coercion - so to what would it coerce? Int or Str? How could the compiler know? Or do you mean something like a tuple? 2. set is unordered collection of values, subset is new

Re: some questions about S02(type)

2009-04-03 Thread Moritz Lenz
Moritz Lenz wrote: 2. set is unordered collection of values, subset is new type. People are apt to confuse the two concepts. Note that people never write subset in their code, the write things like sub f($x where { ... } ) and the where constructs the subset type. I don' think that's

Re: some questions about S02(type)

2009-04-03 Thread Timothy S. Nelson
On Fri, 3 Apr 2009, Moritz Lenz wrote: Xiao Yafeng wrote: 1. Could I set multi-return type?like sub test as (Int, Str) {...} as is coercion - so to what would it coerce? Int or Str? How could the compiler know? Or do you mean something like a tuple? I think