Re: [PATCH] Add arithmetic builtin functions

Pete Dietl <[email protected]>
Newsgroups gmane.comp.gnu.make.bugs
Message-ID <CACB-c0GECPh_AU4EBFgK5UXCsdaDH5d18-rZXZYrg=Zy-TAjcA@mail.gmail.com>
Jouke,

Wed, 20 May 2020 13:42:11 -0400, Paul Smith wrote:
> > Another option would be to introduce some new syntax like $(()),
> > but that might break existing Makefiles and would probably be more
> > work, though it looks cleaner IMO.

> No, I don't agree with that.  Trying to change the base make parser
> like that would be a major source of issues.

> There is already a simple way to hook in a new make function, and any
> new capabilities need to fit within the current function invocation
> model rather than creating brand-new top-level syntax.

I took that to mean that Paul prefers just adding single math functions.

Mon, 9 Dec 2024 10:37:14 +0100, Jouke Witteveen wrote:
> 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.

Yeah I'm totally open to discussing a proposal further. I just felt
like having some working prototype implemented would be useful.





On Mon, Dec 9, 2024 at 1:37 AM Jouke Witteveen <[email protected]> wrote:
>
> On Mon, Dec 9, 2024 at 12:11 AM Paul Smith <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.