Boost logo

Proto :

Subject: Re: [proto] _unpack transform
From: Eric Niebler (eric_at_[hidden])
Date: 2012-07-11 13:32:34

On 7/11/2012 9:55 AM, Eric Niebler wrote:
> I'm going to keep playing with this. Your suggested syntax is nice. I
> wonder how close I can get. (Although I kinda like my pseudo-pack
> expansions, too. :-)

<replying to myself, sorry>

But based on Thomas' suggestion, I'm considering this alternate syntax:


One of the problems I see with Thomas' original syntactic suggestion was
that it gave you no control over /how/ the arguments get unpacked.
Better to have the unpack to appear in a *pattern* that gets repeated.
With the above syntax, I can do:


and it's clear I want:

  f0(f1(f2(child0), f2(child1), f2(child2), /*...*/))

But keeping Thomas' unpack keyword has 2 nice benefits:

1) The wildcard keeps it's meaning. It always means "the current
expression". In my original proposal, a pseudo-pack expression changed
the meaning of the wildcard to mean, "the current child of the current
expression." That might be a bit confusing.

2) I could use a different transform as an argument to unpack. For instance:


That would mean, unpack the children of the current expression's first

But perhaps "unpack" is the wrong name now, since "unpack" and "..."
seem redundant. Maybe it should be "children_of":


Blech, that sucks too. Maybe "pack":


That's no so bad, actually. Now, the question is whether I can retrofit
this into proto-current without impacting compile times.

Eric Niebler
BoostPro Computing

Proto list run by eric at