Re: [Gaea] Named optional attributes
Joel de Guzman <[email protected]>
| Newsgroups | gmane.comp.lib.boost.documentation |
|---|---|
| Message-ID | <[email protected]> |
On 11/2/2011 7:29 AM, Matias Capeletto wrote: > One thing that bugs me about the current definition of if > is that doesn't work like other templates because you can call it with > two or three parameters. To be a real template it should be defined in > the specs as [decl [if cond . branchs]]. But maybe it is somewhat > nitpicking :) I'm not sure I follow. The declaration of if is: [decl [if cond then else]] You need exactly 3 arguments. You can't have 2. > Nice... I was waiting to see what you were thinking about this. > I do not know if I fully understand how it supposed to work. These > variables are not intended to be used as arguments of other templates, > but as a way to create some kind of global variables accessibly by all > other templates? > > [def [unfold . things] [fold [things][][rcat]]] > > [var footnotes-list []] > > [def [section name . blocks] > [set footnotes-list []] > <section> > <title>[name]</title> > [unfold [blocks]] > </section> > <footnotes> > [unfold [footnotes-list]] > </footnotes> > ] > > [def [footnote text] > [def [footnote-id] [size [footnotes-list]]] > <footnoteref id=[footnote-id]/> > [set footnotes-list [append [footnotes-list] [[footnote-id] :: [text]]] > ] > > It feels a little bit strange, but maybe is just the first impression. > Do you have any other use cases? TBH, I'm not quite happy with it either. The language is purely functional apart from that. There should be a way to do above using a purely FP way, but it's not as easy. As always, suggestions welcome. Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com