On Thu, 5 Jan 2006, Akim Demaille wrote: > >>> "Joel" == Joel E Denny <[EMAIL PROTECTED]> writes: > > > On Wed, 4 Jan 2006, Akim Demaille wrote: > >> Le 4 janv. 06 à 20:29, Joel E. Denny a écrit : > >> > >> > I don't see $<foo>3 as simply a waste of characters. I see it as > >> > misleading. It begs the question, "What does `foo' mean?". > >> > >> Well, I wrote foo, but I should have written the actual member name: > >> $<val>3. That's what is needed anyway in the action itself when > >> assigning to $$ (well, $<val>$). > > > OK, but that's not enforced. > > It never is. Bison is not aware of the names of the %union member > (and IMHO, it doesn't have to).
I realize that. I don't believe it has to either... especially considering that it would require parsing C or, worse, C++. However, in all other cases I can think of, the compiler will catch an invalid union member. In this case, the compiler never sees it. I've just inadvertently made an argument for exposing the internal YYUSE.... Nevertheless, even if the compiler sees it, you can put any irrelevant union member there, and it seems strange to have to specify one at all. Joel
