[Top][All Lists]

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

Re: RFC: dogfooding: use api.value.type union

From: Paul Eggert
Subject: Re: RFC: dogfooding: use api.value.type union
Date: Sat, 10 Nov 2018 09:16:09 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

Akim Demaille wrote:

On the scanner side it is not too ugly to replace

     val->uniqstr = uniqstr_new (last_string);
     return TAG;

     val->code = last_string;
     return PROLOGUE;


     val->TAG = uniqstr_new (last_string);
     return TAG;

     val->PROLOGUE = last_string;
     return PROLOGUE;

This is fine but I suggest not uppercasing the names, as the uppercase shouts "I AM A CONSTANT" and the identifier is no longer necessarily a constant.

I also like to move from

   {int} {
     val->INT = scan_integer (yytext, 10, *loc);
     return INT;


   {int}   RETURN_VALUE (INT, scan_integer (yytext, 10, *loc));

with the right macro RETURN_VALUE.

Can we do that sort of thing without macros? Macros are trouble. Yes, we're using macros already, but in this particular case it might be better to avoid them even if it's wordier.

reply via email to

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