develooper Front page | perl.perl6.internals | Postings from February 2002

Re: Keys and Indices PDD

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
February 19, 2002 11:33
Subject:
Re: Keys and Indices PDD
Message ID:
20020219191938.GE12268@Bagpuss.unfortu.net
On Sun, Feb 17, 2002 at 05:51:32PM +0000, Simon Cozens wrote:

> =head2 Aggregate and non-aggregate PMCs
> 
> We've already said that what separates the aggregate PMCs from the
> non-aggregates is their implementation of the C<_keyed> vtable methods.
> So it is Hereby Decreed that the default vtable which everyone inherits
> from defines the C<_keyed> forms to throw an exception. 

> So, if you have a PMC in a C<_keyed> method which you don't want to
> index, pass in C<NULL> instead of a real key. Code implementing these
> methods should understand C<PMC* foo, KEY* NULL> as meaning the entirety
> of C<foo> in some sense; this is trivial to understand if C<foo> is
> non-aggregate, and implementation-defined if C<foo> is aggregate.

On Mon, Feb 18, 2002 at 01:12:24PM -0500, Dan Sugalski wrote:
> Non-aggregates can (and must) implement the _keyed vtable method, 
> though it may well do nothing but throw an exception.
> 
> References, for example, will implement them, just passing the access 
> down to the referent.

So does this mean that (it is likely?) that the default _keyed vtable methods
on a non-aggregate will return self if KEY* is NULL, otherwise throw an
exception?

Or would this return of self mean that parrot is concealing a programming
error from whatever/whoever generated the bytecode?

[Don't ask me about the implications of what I just wrote - it just seemed
like NULL behaviour is something we could either define, or leave explicitly
undefined. Currently it's implicitly undefined]

Nicholas Clark
-- 
EMCFT http://www.ccl4.org/~nick/CV.html

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