RE: [sv-bc] Mantis 1571: proposal for macro defaults

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Mon Nov 26 2007 - 12:56:50 PST
Hi, Eric.


________________________________

	From: owner-sv-bc@server.eda.org
[mailto:owner-sv-bc@server.eda.org] On Behalf Of Coffin, Eric
	Sent: Monday, November 26, 2007 1:33 PM
	To: Bresticker, Shalom
	Cc: sv-bc
	Subject: Re: [sv-bc] Mantis 1571: proposal for macro defaults
	
	
	Shalom,
	
	I've got three comments.
	
	(1) Correct me if I'm wrong, but the sentence which reads "For
macros without arguments, it shall be an error to add parentheses."
implies that the following is illegal.  Is that the intent?  This makes
the following illegal:
	
	`define A SomeIdentifier
	module `A(b, c); input b; output reg c; endmodule
	
	I would like to remove that sentence from the proposal.
	
	[SB] That certainly was not the intent. You are correct that
your example is legal. The intent was to say that 
	(1) in contrast to modules, tasks, or functions, where the t/f/m
call/instantiation may have empty parens even if they don't have args,
with macro calls you may not add redundant parens. One might have
thought that the redundant parens are stripped off.
	(2) in contrast to macros with arg defaults and you use all the
defaults, where the parens are still required, the parens are not
allowed if the macro is defined without any arguments.
	The sentence in question can be deleted from the proposal
without changing its technical content, especially that sentence is not
connected to defaults.
	However, I'd be happy if you can suggest a better wording.
	 
	(2)  The sentence "If an actual argument or an argument default
contains a macro usage, the macro usage shall be expanded only after
substitution in to the outer macro text." makes the following redundant:
	
	When a macro usage is passed as an actual argument to another
macro, the argument expansion shall not introduce new uses of the formal
arguments to the top-level macro.
	
	`define TOP(a,b) a + b
	`TOP(`TOP(b,1), `TOP(42,a))
	expands to: b + 1 + 42 + a
	not into: 42 + a +1 + 42 + a
	nor into: b + 1 + 42 + b + 1
	
	[SB] I'm not sure it is redundant. Greg felt it was important to
clarify. 
	
	(3)  Should the TOP example be kept then note that the example
with the macro `TOP is recursive.  Recursive macro calls are illegal.
Change the example from:
	
	`define TOP(a,b) a + b
	`TOP(`TOP(b,1), `TOP(42,a))
	
	to
	
	`define TOP(a,b) a + b
	`define BOTTOM(a,b) a + b)
	`TOP(`BOTTOM(b,1), `BOTTOM(42,a))
	
	[SB] Yes, thanks.
	 
	Shalom 
	

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Nov 26 13:01:26 2007

This archive was generated by hypermail 2.1.8 : Mon Nov 26 2007 - 13:01:53 PST