Re: [Boost-docs] The beauty of LATEX

Subject: Re: [Boost-docs] The beauty of LATEX
From: Daniel James (dnljms_at_[hidden])
Date: 2011-10-22 09:08:31


On 22 October 2011 02:48, Joel de Guzman <joel_at_[hidden]> wrote:
> On 10/21/2011 6:14 PM, Daniel James wrote:
>> I think your third list is incorrect.
>
> This?:
>
>  [[a][[b][c]]]
>
> How so? Maybe I'm blind :-P

This:

[[a][b]]

is described as '2nd is a single element list with 3 elements.'

so:

[[a][[b][c]]]

is a single element list with 2 elements, but it says it's a 2 element list.

>> The function forward declaration syntax seems a bit ambiguous since
>> there's no clear indication that it isn't a function. It could
>> possibly be followed by a block which isn't meant to be a function
>> body. And quite easy to get wrong (e.g. [def foo][`bar 1 2] would be a
>> bit surprising). I don't actually see why there needs to be forward
>> declarations.
>
> You are right. It is ambiguous. I guess it will all be clearer if
> I present a formal grammar instead of snippets of code. Forward
> declarations may be important for recursive templates though.

I'd just do it in two passes, first parse everything to get the
templates, and then run it. So you can refer to templates defined
later in the file.

>> How do you pass a function as a parameter?
>
> Still working on that. TBH, I'm still unsure about the need for
> explicit function invocation/eval, but I was guessing that it's
> needed to allow functions to be passed in. For example:
>
>  [def dup a][[`a][`a]]
>
> This is a function invocation:
>
>  [`dup [apple pie]]
>
> This is not:
>
>  [dup [apple pie]]
>
> The latter can be passed in to a template like, e.g. transform
> if we have some bind/phoenix like placeholders. E.g.:
>
>  [`transform [`list] [dup _1]]

I think you'll need to add another built-in function for calling
function arguments, such as:

[def foo a][[`call [`a]]]

Otherwise consider:

[def foo a][[`a]]
[def bar][x]
[foo [bar]]

Does invoking [`a] return a list of one item, or the text 'x'?

Whenever you have a list parameter, you'll need to either bind it to
the state at the location it was passed or do a function lookup at
that point, so that this doesn't do the wrong thing:

[def foo f bar][[`call [`f]]]
[def bar][1]
[`foo [bar] 2]

I'm not sure that call 'foo' is correct, the right call might be:
[`foo [[bar]][2]].

Oh, I forgot to mention before, you need something to distinguish
between lists and non-lists, for handling trees.


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