2010/9/6 David Manura
<dm.lua@math2.org>
On Sat, Sep 4, 2010 at 4:08 PM, François Perrad
> This syntax could be replaced by ${dependencies*_depend()}
> or ${dependencies[]_depend()}.
Or maybe ${dependencies/_depend}. That agrees with the Lpeg syntax
for "apply the given function to all elements in the given capture
list" [1]. Another symbol like '//' or '|' would be more unambiguous.
Alternately, extend the attribute syntax you currently use:
${dependencies; map=_depend; format=f}. It does seem to me that such
a map and format do very similar things and should be made to look
more similar: the former applies a function to all members of an
object while the latter applies a function to the object itself. A
pipe-like form might be preferred since unlike the attribute syntax it
suggests that ordering and repetition are preserved:
${dependencies | map _depend | join ',' | apply f}
Maybe also consider allowing the parens to be omitted in
`${_source()}` since in `${_source}` calling rather than
stringification would usually be more sensible for type == 'function'.
The problem is that it complicates handling function-like objects
(having __call).
There should be a way to escape special characters like '$'.
[1] http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html#cap-func