Re: want to mydir->Get("BF/B")

From: Christian Holm Christensen <>
Date: Thu, 24 Aug 2006 17:34:05 +0200

Hi John,

On Thu, 2006-08-24 at 09:40 -0500, Dr. John Krane wrote:
> Hello Christian,
> Just when thought I had forgotten how condescending physicists could be,
> here comes your email!

Sorry if it came across that way. That was not my intention. The point was merely that we're pretty used to things like this, so we don't do it. Hence there's a practise established that has good and sound technical reasons, and which isn't in conflict with (almost) all uses.

> Although I could replace the character as you suggest I do not think
> this is the best option for me. BF/B is the ticker symbol for Brown
> Forman class B shares as used in my other software, so I prefer to keep
> it, and other symbols like it, the same.

If the name is really _that_ important to you, OK.

> Instead I have modified my version of TDirectory in the way I outlined
> below to have a switch that defaults to the official behavior.

whow. This on the other hand, is to me a _very_ bad idea. Not for ROOT, but for you. It means _you_ have to maintain a separate piece of code, and it's not really compatible with ROOT. That is, if you make a file with this code, other ROOT users (your colleagues) may not be able to read it. If you're willing to live with that, I guess it's your choice. I know I'd have a hard time coping with.

If it's really that important to many users to be able to have `/' in the object names, then we should implement some sort of escape mechanism in TDirectory, so that you could do for example

   TObject* bf_b = gDirectory->Get("BF\\/b");

This mechanism could also be used for other `natural' places like spaces, colons, unicode characters, and so on. BTW, ROOT'ers is unicode escapes supported in TDirectories. Perhaps some one would like to have names like "ævlebævle" (apologies to those that cannot see these characters - it's Danish `ae' ligature - and no John, I'm quite serious here - there may be good reasons to support national languages other than en_US - say for education reasons).  

> Now
> *everything* works great for me, including the Get method, nothing is
> broken, and I have theoretical backward compatibility with any
> Get("mydir/mysubdir/myhisto") commands that might be sitting around (of
> which I have none, but it is good policy). I do not make subdirectories
> with a / in them, so the TDirectory "concept" is not affected (and never
> was).

Sorry, but this is where you are wrong. The whole idea of TDirectory is build around `/' being a directory separator. I dare you to find any reasonable file system where you can have file names with '/' in it, and it's a directory separator (non including making a unicoded escape).

> If and when I update to a newer version of ROOT I will just
> relink my more flexible TDirectory again.

I believe this is called a fork. you have every right to do so under the LGPL, but it's hardly advisable.

> Erhm, thanks for your email. The ReplaceAll method looks very nice, and
> I am happy to have my attention drawn to it for a future use.

The TString class is pretty rich, so taking a good look at it would not be a bad thing all in all. And that goes for a lot of ROOT users :)


 ___  |  Christian Holm Christensen 
  |_| |  -------------------------------------------------------------
    | |  Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
     _|           DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
    _|            Denmark                    Office: (+45) 353  25 404
 ____|   Email:               Web:
 | |
Received on Thu Aug 24 2006 - 17:34:18 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET