bug-make
[Top][All Lists]
Advanced

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

Re: Idea: Allow $(name ...) as an abbrevation of $(call name ....)


From: David A. Wheeler
Subject: Re: Idea: Allow $(name ...) as an abbrevation of $(call name ....)
Date: Sun, 09 Jun 2019 23:46:12 -0400 (EDT)

On Mon, 10 Jun 2019 11:56:04 +0900, Masahiro Yamada <address@hidden> wrote:
> It is a design.

Sure, but we can add to it.

> In summary, there is slight difference between
> a variable and a user-defined function.
> Omitting 'call' makes obscure the difference between them.

I don't think it obscures the difference at all.
The presence of parameters makes the difference quite obvious.

Let's use the examples from:
https://www.gnu.org/software/make/manual/html_node/Call-Function.html

# Current:
foo = $(call reverse,a,b)
# Proposed alternative:
foo = $(reverse a,b)

# Current:
LS := $(call pathsearch,ls)
# Proposed alternative:
LS := $(pathsearch ls)


# Current:
o = $(call map,origin,o map MAKE)
# Proposed alternative:
o = $(map origin,o map MAKE)


There is *one* case I can agree would be obscure.
That would be a space with NO parameters. E.g., $(hello ).
That's more likely to be an error than a function call.
So perhaps the short form should require something other than a ")"
right after the name's whitespace; if you want to call a function
with no parameters (why?) you'd be required to use $(call NAME).
I'd be happy with that limitation on the syntactic sugar.

--- David A. Wheeler


reply via email to

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