[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: math expressions (was: Re: Tail call elimination)

From: Paul Smith
Subject: Re: math expressions (was: Re: Tail call elimination)
Date: Mon, 25 May 2020 16:36:55 -0400

On Mon, 2020-05-25 at 10:10 +0000, Edward Welbourne wrote:
> > > Mult-base support: should we support only base 10 integer
> > > constants in
> > > expressions, or also hex/octal constants?
> > I vote for decimal, hex, and binary.
> > Octal if you really want it.
> A case for octal and bitwise and/or is that they're what you need to
> manipulate chmod permissions.  Of course, that'd also require being
> able to *expand* the resulting number as octal ...

I was not even considering specifying the base of the the resulting
expansion.  I was assuming it would always be base 10.  I don't have
any good way to specify the output form.

I was only considering the parsing of input (constant) values: whether
we wanted to support 0xfff, 0o777, 0b111 as well as base 10.  I don't
want to support "traditional" octal values that start with plain 0... I
believe that's always been a bad idea and it's especially bad in the
context of makefiles where values are all strings right up until the
moment they're parsed.

> I would tend towards defining a
>   $(compare before, after, rise, same, fall)
> which evaluates to rise if before < after, same if before == after
> and fall if before > after.

That's interesting but honestly I'm not sure I see the advantage of
doing something like this, over simply supporting the standard
operators with a normal conditional function.  It will certainly be
much more familiar to people.  I guess it's helpful in the less common
situation where you want to do three different things for <, ==, and >,
but it's more annoying for the more likely scenario where you want to
use <= or >=... you have to write the result twice.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]