[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add arithmetic builtin functions
From: |
Jouke Witteveen |
Subject: |
Re: [PATCH] Add arithmetic builtin functions |
Date: |
Mon, 9 Dec 2024 10:37:14 +0100 |
On Mon, Dec 9, 2024 at 12:11 AM Paul Smith <psmith@gnu.org> wrote:
> I reviewed the previous (lengthy) email thread before looking at this
> patch.
I guess you mean the thread that at some point was titled "math
expressions" [1].
Was there any conclusion there? At some point it gravitated to a
shell/Posix-style expr [2] function. There were issues with most, if
not all, proposals and personally I still think arithmetic operators
may be too much feature creep altogether. So far, much of GNU Make's
functionality could be summarized as a fancy rewriting language that
produces commands to be run. The compare function introduced around
the same time as the previous thread is already challenging this
viewpoint, but it could still be considered an enhanced conditional
operator. These newly proposed functions really add "numbers" as a
supported interpretation of variable values (Bash has the same).
Doesn't GNU Make already have Guile integration for cases where you
want not just a rewriting engine? I know that Make is already Turing
complete, so this argument doesn't hold in the theoretical sense, but
still I can imagine more non-idiomatic uses of arithmetic operators
than idiomatic ones.
> I don't see the advantage in creating this special case. If someone
> wants the negation of a value, wouldn't they just write "-$V" instead
> of "$(sub $V)"?
This feels similar to many concerns raised in the original thread four
years ago. In this particular case, "-$V" could result in two
consecutive minus signs, which is probably not what we want.
What I remember from the original thread is that we first needed a
good proposal. I'm afraid the existence of the implementation
suggested now sidesteps the discussion on what functionality is
actually desirable.
Regards,
- Jouke
[1] https://lists.gnu.org/archive/html/bug-make/2020-05/msg00070.html
[2] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/expr.html
- Re: [PATCH] Add arithmetic builtin functions, Paul Smith, 2024/12/08
- Re: [PATCH] Add arithmetic builtin functions, Paul Smith, 2024/12/08
- Re: [PATCH] Add arithmetic builtin functions, Pete Dietl, 2024/12/09
- Re: [PATCH] Add arithmetic builtin functions,
Jouke Witteveen <=
- Re: [PATCH] Add arithmetic builtin functions, Pete Dietl, 2024/12/09
- Re: [PATCH] Add arithmetic builtin functions, Paul Smith, 2024/12/09
- Re: [PATCH] Add arithmetic builtin functions, Pete Dietl, 2024/12/09
- Re: [PATCH] Add arithmetic builtin functions, Pete Dietl, 2024/12/19
- Re: [PATCH] Add arithmetic builtin functions, Paul Smith, 2024/12/26