Lars Gullik Bjønnes wrote:
>>> I can see it is possible. Why is it 'preferable'?
>>
> | Free functions provide (often...) better encapsulation (Scott
> | Meyers?).
> 
> Btu not if they operatoe on global variables... then you do not gain
> anything.

Where do you stand on the particular design under discussion?

We're talking about free functions that provide access to a class's 
member variables. The class declaration, definition and single 
instance is hidden entirely inside a .C file. Whether it is a 
singleton class or not is nothing but an implementation detail.

namespace lyx {
namespace global {
        /** start the whole thing off, instantiating the
         *  class variable that will store lastfiles, 
         *  lyxrc, converters, formats
         *
        void exec(int argc, char * argv[]);

        LastFiles & lastfiles();
        LyXRC const & lyxrc();
        Converters const & converters();
        Formats const & formats();

} // namespace global
} // namespace lyx

Is this a 'good design'? One downer --- it is impossible to provide 
const reference and reference accessor functions with the same name.

-- 
Angus

Reply via email to