Subject: Re: [Boost-docs] [quickbook] Several template bugs & Turing-completeness
From: Joel de Guzman (joel_at_[hidden])
Date: 2008-05-21 06:21:39
Robert Kawulak wrote:
> Hi,
Hi! Please write a trac ticket for this so it won't go
unnoticed, ok? Anyway...
> I've found several bugs regarding templates in Quickbook from 1.35 release:
>
> 1. This does not work:
>
> [template sitelink[page name] [@http://site.org/[page] [name]]]
> [sitelink index.html here] <- "error: Expanding template"
Yeah. It's unfortunate that some old markups do not
expand templates in some parts. The @ markup in particular
does not allow expansions in the url part. This should be
solved as soon as we rewrite them as templates. For example,
this works:
[template ulink[url name] '''<ulink url="'''[url]'''">'''[name]'''</ulink>''']
[template sitelink[page name] [ulink '''http://site.org/'''[page] [name]]]
[sitelink index.html here]
(Be careful with the slashes! They are regarded as italics)
> 2. This causes access violation (memory write):
>
> [template join1[a b] [b][a]] <- "error: Expanding template"
> [template join2[a b] [a][b]]
> [template test[x] [join1 [join2 0 [x]] 0]]
> [test 0]
There's definitely a bug there. Please have a trac ticket.
Anyway, there's also a user error here. Here's what happens:
[join1 [join2 0 [x]] 0]
join1 has (technically) a single arg:
[join2 0 [x]] 0
which quickbook then tries to break into 2 as required by the
template. It gets broken at the first whitespace. Thus the
args will be:
1) [join2
2) 0 [x]] 0
...not as you'd want. In case of ambiguities like this, use
the unambiguous argument separator:
[template join1[a b] [b][a]]
[template join2[c d] [c][d]]
[template test[x] [join1 [join2 0 [x]]..0]]
[test 0]
> 3. It would be nice if this worked:
>
> [template t1 foo]
> [template t2[t] [[t]]]
> [t2 t1] <- "error: Expanding template"
That will require multiple expansion passes. Tricky! Anyway, if you
really want it, then please add a trac "feature request" ticket.
> 4. Sometimes, when a matching ']' is missing, Quickbook hangs with 100% CPU
> usage. However, I don't have any code snippet causing this right now.
Yeah... well, it would help a lot if you can provide a simple
test case so we can look into it. Again, trac ticket.
> BTW, in the docs there is a statement that Quickbook is Turing-complete. This
> made me curious, but I haven't figured out yet how this works. Could somebody
> send an example of some simple algorithm executed using Quickbook? Thanks in
> advance. ;-)
Hmmm... yeah. Well, this is an unsubstantiated claim. Anyway,
in as much as the Boost PP guys shows that the PP is Turing-
complete, QB has the same mechanisms (more powerful in some
regards, in fact). It has the basic ingredients like recursion
and branching to make it so. Alas, I do not have time to
actually prove this.
Regards,
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
This archive was generated by hypermail 2.1.7 : 2017-11-11 08:50:40 UTC