[Top][All Lists]

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

Re: named arguments in m4?

From: Daniel Goldman
Subject: Re: named arguments in m4?
Date: Mon, 21 Apr 2014 15:18:01 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 4/21/2014 8:53 AM, Gary V. Vaughan wrote:

For the record, the syntax I briefly implemented simply involved defining a 
with a parameter list, and then referring to parameters by name in the body of 

   m4_define(`exch (parm1, parm2)', `$parm2 $parm1')
   exch(`foo', `bar')
   bar foo

It's still something I'd like to have one day, but I'm not sure I like that 


Actually, that syntax looks reasonable to me. Your syntax is certainly better than the suggestion I made, which I find confusing. At first glance, your syntax seems pretty clear. And it's good that it resembles the cpp syntax:

#define EXCHANGE(arg1, arg2) arg2 : arg1
EXCHANGE(Arg #1, Arg #2)

I imagine adding new capabilities to m4 is a huge amount of detailed work. Thank you for answering my newbie question. I might have some other questions in the future, as I explore m4.

I previously used cpp, sed, and "htp" for various text pre-processing tasks I'm mostly moving over to m4. I wish I had learned m4 before. Thank you for having this discussion group.


reply via email to

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