bison-patches
[Top][All Lists]
Advanced

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

RFC: c++: it's just a question of style


From: Akim Demaille
Subject: RFC: c++: it's just a question of style
Date: Sat, 22 Dec 2018 16:36:02 +0100

...and it's running after you.


The C++ parsers are somewhere between two styles of C++: keep declarations and 
implementations separate (i.e., first declare yy::parser as a collection of 
signatures, and afterwards, provide implementations of these signatures), or 
directly implement in the class.

I went initially for the first tradition, because it makes it easier for the 
reader to see the interface of the class, especially if she does not use an IDE 
that automatically hides implementations.

But it also makes the implementation more painful to read, especially with 
inner classes such as semantic_type, stack_symbol_type, symbol_type, etc.  Not 
to mention that it's twice as much work for the implementor, and he's getting 
tired to this.  

Originally most of the auxiliary classes where defined outside of yy::parser, 
but several of them have moved inside of it, so the legibility already went 
down.  It's possible to move the implementation of these auxiliary classes 
outside of their classes, but I have no desire at all to do that, it's already 
complex enough this way.  That's why we are now somewhere between these two 
styles.

I'm tempted to fully move to the second option.  Any opinions on this?

(To be clear: I'm referring _only_ to the implementations exposed in the 
header. I don't plan to move those that are in the *.cc file).


reply via email to

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