LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

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
Subject:
From:
Bruno Le Floch <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Thu, 10 Jul 2014 19:20:48 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (56 lines)
Hello list,

Sorry for the >1 month delay.  This is a followup to the thread asking
whether letting juxtaposition denote multiplication was a good idea.
I think it was, but I made a big mistake in making juxtaposition be
multiplication with a _different precedence_ than the asterisk.

On 6/9/14, Joseph Wright <[log in to unmask]> wrote:
> On 09/06/2014 13:25, Lars Hellström wrote:
>> A data point of possible interest is MetaFont, which has some cases of
>> juxtaposition as a high priority operation (e.g. 2/3x means two thirds
>> of x). Since it's Knuth, it's probably very consistent, but not
>> necessarily intuitive.
>
> I guess Bruno can say more, but I suspect that requiring explicit "*"
> for multiplication might have a benefit in terms of code complexity (no
> need to allow for other cases). An obvious question for me is would such
> a position lead to problematic cases? The comparison with MetaFont is
> probably a useful one in this regard.

From reading (short) old discussions on when I decided to allow
juxtaposition, MetaFont was indeed an inspiration for making
juxtaposition bind very tightly.  Another inspiration was pgfmath,
which allows juxtaposition for dimensions only, and treats a number
and its dimension as a single operand for any operation:

    \input pgfmath
    \pgfmathparse{.25pc^2}
    \show\pgfmathresult % gives (.25*12pt)^2 = 9.0

In l3fp, I pushed the idea to its extreme, allowing juxtaposition for
things other than units, and I kept the precedence as being the
tightest possible.

As Lars rightfully says it's "consistent, but not necessarily
intuitive".  Andrew has given several cases where my choice leads to a
terrible behaviour for l3fp, and there is basically no case where the
current behaviour is better (well, there was one abusive one: with
this rule, exp.5ln(...) computes the square root, but now that is not
needed).

I'm keen on leaving juxtaposition = multiplication, because that
allows to use dimensionful numbers directly inside fp expressions (pt,
in, ... are defined as floating point constants).  I believe that we
should change the precedence of juxtaposition-as-multiplication from
what it currently is (the tightest) to being the same as
multiplication.  In other words, juxtaposition would behave exactly
identically to adding an asterisk.

Would that make sense?  Am I missing something crucial (probably... I
didn't realize when allowing juxtaposition what a mess I was
creating)?

Best regards,
Bruno

ATOM RSS1 RSS2