Andre Poenitz wrote:
On Thu, Sep 28, 2006 at 12:39:57PM +0200, Abdelrazak Younes wrote:
Again, I prefer to have one single point of access for all global
variable. The logical place to put them is in Application. When it's
written "theApp->XXX", I know that this is a unique instance variable.
"XXX" alone doesn't tell me anything by itself.
You could have global accessors
Applcation & theApplication()
LyXFunc & theLyXFunc()
BufferList & theBufferList()
etc.
But these don't provide const access. Besides, I still prefer
theApp->XXX() notation. In my mind Application should enclose every
singleton that we need in this application precisely. But this is just a
code style issue. I am not going to fight for this if a majority hates
this style.
Are you sure that gcc doesn't? You can compile this:
class A;
class B {
private:
boost::scoped_ptr<A> a_;
}
If it compiles it is coincidence. It is not required to
compile without a full declaration of 'A' in scope.
So MSVC is not to blame here.
FYI, Application with these forward declaration compiles with MSVC but
other .C file that include Application.h don't compile without the other
headers. It would be interesting to know if gcc compiles though.
I hope you mean pimpl Application.
Of course I mean "put these member in a pimpled Application".
Ok.. so if 'Application' is really only a very cheap wrapper around a
set of otherwise global entities, and everything hides behind a pimple
such that #include "Application.h" is really cheap (as in "does not
ppull in other headers") I could live with it even as a long-term
solution even if I think that serpate singletons are better.
Again, I will follow the majority here. At least for "BufferList" and
"LyXFunc". But I would like to keep "Clipboard", "Selection" and, in the
future, "quitting" and "FontLoader" in "Application".
FWIW, I agree that LyXFunc does not even have to be visible in the code.
I would be happy with a global "dispatch()" method.
Abdel.