white space between tick and identifier (was Re: [Fwd: Re: [sv-bc] P1800-2008 draft 4 pg 526])

From: Coffin, Eric <eric_coffin_at_.....>
Date: Tue Mar 04 2008 - 15:26:34 PST
Greg,

I was unable to find where the LRM mentions that compiler directives 
start with a tick and must be immediately followed by an identifier or 
an escaped identifier.  However, the LRM does call out that spaces may 
not exist between the '$' and the identifier name for sys task/funcs, 
and the LRM also calls out that spaces may not exist after the single 
quote when specifying based numbers.  I would like to see the LRM make a 
definitive statement for this case not just for macros but for all 
compiler directives.

I think that spaces between the tick and the identifier should be 
allowed for at least two reasons.  First, backwards compatibility.  If 
space between ticks and idents becomes illegal some designs will no 
longer compile.  I cannot think of any situation where a design would 
cease to compile because a tick-space-ident would then be interpreted as 
a directive.  The second reason that spaces should be allowed involves 
`ifdef/`else/`endif.  Some coding styles line up the tick in the first 
column on a line and then indent the ifdef/endif to indicate nesting 
level. 

-Eric


Greg Jaxon wrote:
> Coffin, Eric wrote:
>
>   
>> Greg,
>>
>> How about another option:
>>
>> d) 666 + 42 + 42 + ke + ke
>>
>> Wouldn't that make more sense if the use of 'foo' and '\foo' were first 
>> substituted with ke and then the body were further expanded?
>>
>> -Eric
>>     
>
> Yes, that's actually what I meant to write for (b), sorry.  It's the next most
> sensible answer once escaped names are made secure.  The power for a macro
> to invoke an actual argument as a macro looks nice in such a small example.
> Expanding `sna(ke+1) as  666 + 42+1 + 42+1 + ke+1 + ke+1  looks less
> appealing than           666 + 69 + 69 + ke+1 + ke+1 .
>
> My related question about the "tokenness" of `identifier also sets up
> the question of whether getting ` and ke together in this example doesn't
> perhaps require token gluing.  If not, then can I:
>
> `     define foo tasking4it
>       always begin `
>          foo( arg1, arg2 );
>       end
>
>       task tasking4it( a, b );
>         ...
>       endtask
>
> ?
>
> Greg
> Greg Jaxon wrote:
>   
>>  `define \foo(3)  666
>>  `define sna(foo) `\foo(3)  + `\foo  + `foo + \foo  + foo
>>  `define foo 69
>>  `define ke 42
>>
>> Does  `sna(ke)  expands to:
>>
>>   a)  666 + 69 + 69 + ke + ke
>>   b)  `\ke(3) + `42 + `42 + 42 + 42       // with errors of course
>>   c)  `\ke(3) + `\ke  + `42 + \ke  + 42   // also errors
>>
>>
>>   
>>     
>
>
>   

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Mar 4 15:27:05 2008

This archive was generated by hypermail 2.1.8 : Tue Mar 04 2008 - 15:28:14 PST