m4-patches
[Top][All Lists]
Advanced

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

Re: FYI: 5-gary-macro-formal-parameter-first-cut.patch


From: Akim Demaille
Subject: Re: FYI: 5-gary-macro-formal-parameter-first-cut.patch
Date: Sat, 14 Jun 2003 09:07:10 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

| >  > I hate dynamic scoping :(  But it's already the rule here, so...
| 
| It just requires a mental gear shift -- much like using M4 at all
| :-) And as you say it seems more fitting to the style of M4.

For macros, agreed, but definitely not for arguments.

| >  > Nice idea, but I need more time to think about this.
| > 
| > Not a good idea.  $1 etc. have a completely different behavior, of
| > course.
| > 
| > Consider:
| > 
| >         define([foo], [[[$1]]])
| >         foo([bar])
| > 
| > That would never work with pushdef.  That's also why I'd like to
| > encourage a $ mark for the arguments, they are special beasts.
| 
| That's how it works in CVS already (hmm actually it seems to be broken atm):
| 
|     define('foo(baz)',```$baz''')
|     foo(`bar')
|     => `bar'

I hope so!!!  I'm saying that pushdefing will not lead to the
behavior, because the propagation of arguments is brute force
substitution, not macro expansion.  That's why the (current) $ should
be kept everywhere, imho.


| > And actually, I also think addressing this issue should be done
| > simultaneously with prototyping, i.e., m4 should complain when there
| > is not the right number of arguments etc.
| 
| Agreed, I was aiming here too.
| 
| > But then we need to support multi-prototypes macros.  Maybe we should
| > have a look at Perl?
| > 
| >      define([foo($a, $b; $c, $d; $e)], ...
| >
| > Would support 2, 4 or 5 arguments.  Hm.  How about 0?  And how about
| > n-ary macros?
| 
| Ick!  I hate perl ;-)  I was thinking more like common lisp:
| 
|     define(`foo(a, b, &optional (c bar), (d baz), &rest e)', ...)

Ick!  There has never been keywords in M4, I'm not found of starting
now!




reply via email to

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