Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-06-07 00:10:00


"Eric Niebler" <eric_at_[hidden]> wrote in message news:40C3684F.6040000_at_boost-consulting.com...
|
| Gregory Colvin wrote:

[snip]

| > *x = *y

[snip]
| 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;

[snip]
| That's why I have been
| considering this:
|
| rule<> a, b;
| a *= parser >> that >> refers >> to >> b;
| b *= parser >> that >> refers >> to >> a;

maybe

rule<> a, b;
 a = parser >> that >> refers >> to >> b;
 b = parser >> that >> refers >> to >> a;
 a = a.clone();

?

| 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?

I'm not an expert spirit user, but the current semantics already carries some
conceptual overhead with it. Anything that can reduce surprises would help. And
I can replace this code

template< int >
rule<>& some_rule(...)
{
   static rule<> r = ...;
   return r;
}

rule<> r1 = some_rule<1>(...)
rule<> r2 = some_rule<2>(...)

with

rule<> some_rule(...)
{
   return ...;
}

rule<> r1 = some_rule(...)
rule<> r2 = some_rule(...)

br

Thorsten


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