develooper Front page | perl.perl6.internals | Postings from December 2001

Re: Key stuff for aggregates

Thread Previous | Thread Next
From:
Jason Gloudon
Date:
December 5, 2001 07:29
Subject:
Re: Key stuff for aggregates
Message ID:
20011205102829.A5241@gloudon.com
On Wed, Dec 05, 2001 at 12:18:53AM -0800, Brent Dax wrote:

> I'm probably just inexperienced and idiotic, but what's wrong with
> simple 'get_from_aggregate target, aggregate, key' and maybe
> 'get_list_from_aggregate target_list, aggregate, key_list'?  (Obviously
> we'd shorten the names, but you get the idea.)  target would be set to
> the actual element, not just a copy of it, so setting that would set the
> original.

This is not the whole picture as the elements of an aggregate do not always
have associated vtables to compute with. Consider an array of native integers
(or native doubles). If you 'get' an lvalue from it, you won't know the
underlying type, so computing with it is messy unless you wrap the lvalue up in
some type of reference PMC. Creating one to access every element of an array
will create lots of extraneous temporaries.

Using the aggregate's vtable is another way of getting the job done that avoids
all the extra reference PMCs. However, references will have to be supported.

-- 
Jason

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