Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-07-03 09:43:37

Rene Rivera wrote:

> >One other thought if that doesn't seem apporpriate for what you need... to
> >do the unwrapping I'd add another accessor like this:
> >
> >l0 = [ $(l).get-at 0 ] ;
> >ECHO $(l0[1]) ;
> >
> >A better name than "get-at" would be good though.
> OK, both are implemented and tested now :-)
> Couldn't think of a better name than get-at.

Oh... that's "get-at" I was interested in. Now, in function returing two
lists I'd write

return [ new list [ new list $(l1) ] [ new list $(l2) ] ;

and at call site:

t = [ some-rule ] ;
x1 = [ $(t).get-at 0 ] ;
for e in $(x1) ....

Great! This is certainly better than separating the two lists with "@" and
manually unpacking them.

I've have two nits, though. You better document that the 'list' class uses
1-based numbering ("mimics std::list" made me though differently), and
document the new 'get-at' method, as well as 'at', now that is accepts
several indices.

BTW, I'm really thinking that $(l[0]) should result in error. Jam's checking
for errors in variable expansion is rather sloppy.

I'm also not sure about the name "list". It causes confusion with jam's
lists. Can we use a different name, something like "tuple", or "vector"?

- Volodya


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at