Joel de Guzman wrote:
> My proposed syntax:
>
> x[super 2]
>
> does not have this problem. You do not need to add a space between
> x and the template /super/. It is also sufficiently unambiguous.
> It does not look like a common function call so you do not have
> to resort to some naming convention, like double-underscores.
>
> If there are no objections, I'd like to switch to this syntax to
> templates. Applying it to macros will break existing qbk files,
> which I do not want to do. So, I'll just let them be and get
> them deprecated. That means, I'd like templates to totally replace
> macros.
>
> So, going back to John's experiment, I'd like the final qbk code
> to be:
>
> [template alpha[] '''α''']
> [template super[text]
> '''<superscript>'''[text]'''</superscript>'''] [template pow[a,
> b] [a]'''<superscript>'''[b]'''</superscript>''' ]
>
> Notice [text], [a] and [b] are bracketed. They are essentially
> templates that exist only in the duration of the template body
> (that is their scope). Notice too that alpha[] is a nullary
> template.
>
> Then...
>
> x[super 2]
> [pow[x][2]]
> [pow[alpha][2]]
>
> I am confident I can get this to work. Comments? Objections?
I quite like that, certainly it makes univariate macros look just like
quickbook built-ins, I'm not so sure about the multivariate syntax, but I
don't have strong objections.
Hmmm, currently builtins with multiple arguments have them separated by
whitespace, could we preserve this behaviour and fall back to putting []
around arguments only if the argument contains whitespace?
So:
[pow x 2]
does what you would expect.
[pow x a + b]
places "a + b" as the superscript, it's the same as:
[pow x [a + b]]
while
[pow [x - y] [a + b]]
separates it's arguments as you'd expect (a bad example though in the math
sense).
This follows the existing rules for builtin's I think, with the extension
that arguments can contain deliberate whitespace if you put [] around the
arguments. And of course [] would be an empty-string-argument.
How does that sound?
John.
_______________________________________________
Boost-docs mailing list
Boost-docs@...
Unsubscribe and other administrative requests:
https://lists.sourceforge.net/lists/listinfo/boost-docs