help-make
[Top][All Lists]
Advanced

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

Re: What should an $(add) function look like


From: Tim Murphy
Subject: Re: What should an $(add) function look like
Date: Sat, 31 Oct 2015 21:28:58 +0000

On 31 Oct 2015 8:10 p.m., "Reinier Post" <address@hidden> wrote:
>
> On Sat Oct 31 19:25:40 2015, address@hidden (Tim Murphy) wrote:

> > $(add 1 2  3 -1 1)
>
> I like this, to me it seems to fit more naturally with existing
> functions.  As the name I would use 'sum': 'add' suggests only
> twp arguments and suggests that one of them is modified,
> neither of which is the case.

OK, sum it is then. Thanks, that is much nicer.

> > This might turn out to be much more generally useful.   e.g. adding a
list
> > of file sizes together or something similar.  Is this a good idea?
>
> It would be even more general to add higher-order functions (map, fold).
> Don't create a bag of functions, create a Lisp.

I would indeed prefer to do as you say.  One nice aspect of loadable
functions is that they can be created and tossed aside if we think of
better ways to implement them unlike functions that are built in to make
where one feels that there there can never be any going back once a
decision is made.

> > I also think that some numeric comparison functions might be handy e.g.
> > $(gt x,y) and $(lt x,y) plus the other obvious variations. Is there
> > anything else worth putting in?
>
> To be honest, I'm conflicted about functions being present at all.
> Originally, make was on an equal footing with the shell: it just
> created the execution logic, with all the real work being delegated
> to executables.  It makes sense to add computing power on the values
> of variables, like bash did, but I'd avoid adding all kinds of
> specific functions just because they are useful - that will become
> ugly, you'd never stop adding more functions, just like it happened
> in Perl 4 and PHP.  It seems more useful to focus on general,
> extension mechanisms that would allow makefile writers to easily
> add their own functionality; for

I think there are just a couple of areas where lack of certain functions
like an integer increment makes it incredibly difficult to implement a
function in make syntax (i.e. for use with $(call)) and when that happens
one is discouraged from writing functions.


> a way could be added to directly call the main() function
> of arbitrary compiled executables so as to avoid the fork().

Hmmmm, I imagine the problem is that the code would have to be built with
-fPIC. Then it might indeed work. One could have a bunch of tools built
especially to be usable that way.

Another possibility with some tools that work on streams might be to have a
way to start them up once and keep feeding input to them and grabbing the
output during the parsing of the makefile.

Regards,

Tim _______________________________________________
> Help-make mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-make


reply via email to

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