Hi Alexander, you are right and of course I thought about putting the globals (gPad, fFile, gDirectory) as static member of their respective classes. First I thought about typing economics, typing Pad() at the command line instead of TVirtualPad::Pad() makes a difference. However, thanks to a later deviced CINT "trick" I can still allow users to type gPad and so now there is no econimics reason anymore I will make them static methods. Cheers, Fons. On Tue, Feb 29, 2000 at 10:28:38AM +0100, Alexnder Zvyagin wrote: > Hi, > > > in the current version gPad is actually a function with the name Pad(). > > So you can use if (Pad())... However, due to possible name clashes with > > other global functions from other libraries we've changed Pad() to R__Pad() > > in the coming release. So, use Pad() now and change to R__Pad() when you > > get the next release. > > > > Cheers, Fons. > > It seems that static method of class TPad will be good here, something > like this: > > class TPad : public TVirtualPad > { > .... > public: > static TPad * Pad(void); // or another, better name of this method > .... > }; > > And user have to use TPad::Pad() instead of gPad. > The benefits are > 1) this is good C++/OO construction (global property of the class) > 2) it does not pollute global namespace. > > What do you think about replacing ALL global > ROOT variables (gDirectory, gFile, ...) by static methods of theirs > classes: TDirectory::Dir(), TFile::File(), ... > > Of course this is not necessary. But if this thing (using static methods > of classes instead of global variables) will be intoduced, ROOT code will > be more flexible (for such modifications like supporting threads). > > P.S. Please remember, moving all ROOT classes in ROOT namespace will > eliminate problem with > "name clashes with other global functions from other libraries" > > With best wishes, > Alexander Zvyagin. -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET