[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: %destructor feedback
From: |
Frank Heckenbach |
Subject: |
Re: %destructor feedback |
Date: |
Sun, 23 Oct 2005 01:07:26 +0200 |
User-agent: |
semail 20050409 |
Joel E. Denny wrote:
> On Sat, 22 Oct 2005, Frank Heckenbach wrote:
>
> > Joel E. Denny wrote:
> >
> >> On Fri, 21 Oct 2005, Frank Heckenbach wrote:
> >>
> >>> Akim Demaille wrote:
> >>>
> >>>> Maybe that does not deserve that much attention: it seems pretty weird
> >>>> not to use a value. A warning seems a better feature.
> >>>
> >>> I sometimes attach some kinds of flags (integer type) to some
> >>> symbols that I need in some, but not all, rules that use that
> >>> symbol. So, if you go for the warning, could you please make it
> >>> optional? (I think it would be a useful feature in general,
> >>> including several of my grammars, but in some cases I'd probably
> >>> prefer to turn it off.)
> >>
> >> If your semantic value is just an integer, then you probably won't declare
> >> a destructor. In that case, I should think there's no reason for bison to
> >> generate a warning. Would that resolve your issue?
> >
> > That would probably work. However, I'm considering whether such a
> > warning might not be useful even in absence of destructors in many
> > cases (not the above-mentioned grammar, of course, but many others),
> > as not using a semantic value is often, as Akim said, pretty weird.
> > I can't really tell off-hand. I guess I'd have to check the effects
> > of such a warning on my grammars (which usually don't have
> > destructors, yet), but I suppose it would be useful in a number of
> > cases.
>
> Yeah, I think I agree. However, instead of a global switch, I still argue
> that something like YYUSE($5); in the semantic actions would be cleaner.
> That way, when looking at a semantic action, you'd be able to tell exactly
> which semantic values were intentionally not used. Of course, for old
> grammars, going back and adding these might be a bit of work...
Yes. And it wouldn't be backward-compatible with older Bison
versions that don't have YYUSE. I guess one could #ifdef around it.
OTOH, making the warning optional shouldn't take more than a global
flag in Bison unless I'm missing something. (Newly written code
without backward-compatibility concerns could, and perhaps should,
still use YYUSE then, of course.)
Frank
--
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)