Re: [Gaea] Named optional attributes

Joel de Guzman <[email protected]>
Newsgroups gmane.comp.lib.boost.documentation
Message-ID <[email protected]>
On 11/6/2011 5:58 AM, Matias Capeletto wrote:
>>> [var footnotes-list []]
>>>  [set footnotes-list [append [footnotes-list] [...]]
>>
>> 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.
> 
> At least it follows scheme's (define x y) (set! x z).
> 
>> As always, suggestions welcome.
> 
> I was asking about other uses cases, because if it is only introduced
> to deal with footnotes in HTML maybe they shouldn't need to be
> introduced right now if it is only used to produce LaTeX or Docbook.
> That way you can get some time to see how the real implementation
> works.

Indeed.

> If they are introduced, I am tempted to add a [push mutable-var
> element] construct so the collectors are easier to write.

Well, that's easy:

  [def [push x e]
    [set [x][append [x][e]]]
  ]

What's interesting is that you should be able to pass 'var'
arguments much like C++ references.

The side-effects make me feel uneasy though. Here, push
has side-effects while append (and the rest of the gang)
does not :-(

Regards,
-- 
Joel de Guzman
http://www.boostpro.com
http://boost-spirit.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.