develooper Front page | perl.perl6.language | Postings from October 2006

Re: where constraints as roles (was Re: how typish are roles)

Thread Previous | Thread Next
From:
Larry Wall
Date:
October 28, 2006 09:16
Subject:
Re: where constraints as roles (was Re: how typish are roles)
Message ID:
20061028161541.GA4547@wall.org
My initial inclination is to say that "where" clauses in a signature
are only there for pattern matching, and do not modify the official
type of the parameter within the function body.  However, on a "subset"
the "where" clause is there precisely to contribute to the typing,
so if you want the extra constraints to apply to all uses of the
parameter variable within the body, you'd need to declare a subset
type that enforces it.

On the other hand, I can imagine that an alternative would be to say
that a "where" clause will always "subsetize" the official type;
that would imply that we'd need to add a "when" clause for mere
pattern matching.  Something to be said for making such a distinction,
if it can be taught.

Fuzzily yours,
Larry

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About