Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-06-06 13:54:07


Gregory Colvin wrote:
> On Jun 6, 2004, at 10:12 AM, Eric Niebler wrote:
>
>> The syntax issue is this: if we take assign to be shallow (creating
>> aliases) we need a different syntax for deep assign. I am using *= to
>> mean deep-assign. Perhaps there is a better solution.
>
>
> *x = *y
>
> ?
>

I thought about this. I wasn't sure how well it would be received.
People would have to write their grammars like:

rule<> a, b;
*a = parser >> that >> refers >> to >> b;
*b = parser >> that >> refers >> to >> a;

It strongly evokes the rule-as-pointer metaphor, which is good. However,
*b already has a meaning in spirit: match rule b zero or more times. It
would be possible to implement it such that *b= means "deep copy"
whereas *b when it appears in a rule has the familiar kleene star
meaning. This could confuse users though. That's why I have been
considering this:

rule<> a, b;
a *= parser >> that >> refers >> to >> b;
b *= parser >> that >> refers >> to >> a;

I don't know. Another question is: would spirit's users accept any
amount of syntactic/conceptual overhead to have a rule with standard
copy semantics and that was able to track its references and avoid
cyclic dependencies?

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk