Re: [Boost-docs] [Gaea] Named optional attributes

Subject: Re: [Boost-docs] [Gaea] Named optional attributes
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-11-06 01:08:25


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

This archive was generated by hypermail 2.1.7 : 2017-11-11 08:50:41 UTC