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 something like a tuple? > as what Timothy S. Nelson say > > > 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 > I think subset can define a new type, I'm custom to set it at head of code, subset name_string of Str where {~~/^^name/}; am I wrong? > > > 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 test of Bag(test_name Str, test_ID Int, primary key(test_ID))