LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Bruno Le Floch <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Fri, 28 Aug 2015 23:26:22 +0200
text/plain (70 lines)
>>> We do the same in xparse :-)
> Are you saying xparse handles _matching_ of _nested_ parentheses? Because
> that is what I meant that I demonstrated. Using delimited arguments to grab
> parentheses without considering how they match against each other is of
> course a triviality, but also not useful for the problem considered.

Joseph understood your point perfectly well.  Xparse takes care of
matching nested parentheses, and does that expandably too.  It would
be possible for Andrew to abuse xparse to grab his parenthesized
group, but I am not sure whether I want to advise this or not.  It
would also be possible to simply copy the code, but finding out where
this is done in xparse's code is non-trivial.  I could also just
provide code that does that, but it would take 30 minutes to get
completely right and clean (the code needs to carefully preserve
braces when grabbing delimited arguments, for instance).  Using
\tl_set_rescan:Nnn seems reasonable given the above.

>>>> PS: I maintain that that approach to evaluating infix boolean
>>>> expressions is far superior to what is currently offered in LaTeX3, but
>>>> Bruno just seems to *love* his&&, with all its shortcomings. ;-)
>>> Will remind myself: as has been noted there is an issue with clearing up
>>> certain tokens with the current lazy evaluation method.
> More fundamentally, I believe it only supports expandable tests. There is no
> need for a boolean evaluation logic to require tests to be expandable (and
> nor does the logic itself need to be non-expandable).

That is correct.  We had internal discussions at some points and some
people in the team felt that it was useful to know that boolean
expressions were always expandable, hence that the lack of predicates
for protected tests was a feature.  This may have changed since.

>> BTW, thread you mean starts
>> I think the one you mean is
> Ah, that is correct.

The main reason I didn't get back to those ideas of yours were lack of
time at the time, not lack of interest.

>> P.S. Boolean expressions are Morten's code, not Bruno's :-)
> Oh? I seem to recall Bruno posted repeatedly on it this summer, giving the
> appearance that he was actively working on precisely that code. My bad, in
> that case.

I have indeed posted about that topic because lazy evaluation causes
problems when the arguments of a predicates contain parentheses.  Your
approach (replacing && by and, || by or, and parsing using delimited
arguments) does not solve that, nor can any approach where parentheses
have a syntactic role while also being able to appear as unbraced
arguments to predicates.  E.g.,

   ( \c_false_bool && \token_if_eq_meaning_p:NN ) ( )

will typically not be parsed correctly if any attempt is made to do
lazy evaluation and jump from && (or "and" in your syntax) to a
following ")".  There are rare cases where the current LaTeX3 approach
will work and an approach using delimited arguments will not.