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

Re: Hyperoperators and the Each role

Thread Previous | Thread Next
Larry Wall
July 18, 2006 21:17
Re: Hyperoperators and the Each role
Message ID:
On Mon, Jul 17, 2006 at 06:06:52PM -0400, Christopher Jeris wrote:
: I have a couple of questions about what S03 says about hyperoperators
: applying recursively to any object which matches the 'Each' role:
: [from S03]
: Seq(3,8,[2,Seq(9,3)],8) >>-<< (1,1,2,1); # Seq(2,7,[0,Seq(7,1)],7)
: 1. What determines the concrete type of the result of a binary
: hyperoperator which is applied to objects of two different sequence types?
:  Does the example mean that binary hyperoperators are not symmetric (in
: type) even when their underlying operator is symmetric?

Good question.  We'll have to come up with a strategy for that.  Obviously
if the two sides are the same container type, we'd like to keep that.
If they differ, then there are several approaches to finding a common
container type, I imagine.  Doubtless it will end up coming down to
some kind of hidden MMD dispatch on container types.

: 2. Will the 'Each' role require objects implementing it to be, not only
: destructurable, but constructible - as the hyperoperator in the example
: constructs a fresh Seq?  Does this mean that hyperoperators won't apply to,
: say, database result sets?

I would say that constructable is too strong--it merely needs to be clonable
as a container and fillable with the results, assuming the container in
question is able to contain the result type in question.  That might entail
an each variant that mutates the type of the cloned container's elements.
But I'll leave that up to the implementors.  :)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About