You are here

ROOT::TSeq::GetSize() or ROOT::seq::size()?


It's time to resume this blog - on what the ROOT team is up to; what happens at the C++ meetings; and a bit of behind-the-scenes of cling and ROOT.

We have started to develop towards ROOT 7 and its new interfaces. We will have bi-weekly meetings to discuss some of items relevant for our users - we'd love to have you involved as much as possible! If you are curious then please subscribe to the root7-discussion egroup.

Already now, before the first meeting, we have an interesting case: new interfaces should nicely interoperate with the standard library; as such we want them to have members called empty() and size(). On the other hand they are ROOT classes - and you are used to IsEmpty() and GetSize(). And inconsistent interfaces are the worst.

Which of these options do you prefer, and why?

  1. Offer both GetSize() and size(), one calling the other.
  2. If a class is called TWhatever it has GetSize(). Call the class ROOT::whatever to signal that is follows the standard library coding conventions, i.e. size().
  3. TWhatever::size() is just fine and not a problem.

I'm leaning towards the second option. Others prefer the first. And you?

Cheers, Axel.


Hi Axel, these are great news! I always thought that Root would never move from its current design to keep backwards compatibility, and that maybe a brand-new framework would have raised in a decade or so from now when the limitations of the current Root design have become too impairing. So Root 7 is very welcome from my side. About your question, I like the option 2 as you do, and since you are about to break the interface I would go down to the end and rename all the TSomething into ROOT::something. For accessors I would do something like Qt does: if a class has a property called prop, then the getter would be named prop() and the setter setProp(). And obviously no public members at all. I know it's a lot of work and headaches with angry users :)
Good work!

I think I like option 2 the best with the personal preference for first capital letters on class names. So `TSomething::GetSize()` would become `ROOT::Something::size()` (rather than `ROOT::something::size()`).

If we're going to be breaking backward compatibility in these small ways (which I think is long overdue) then we may as well do it right.

I can't get to the root7-discussion mailing list. If I follow the link from , I get "permission denied", and if I search for "root" on the e-groups page, nothing appears containing "root 7". Am I missing something?

I get the same problem now, except the link now opens "Error! e-group already deleted by another user"

Hi Dmitry!

That's really bad, because I cannot reproduce that. That's after you logging in? The link seems to work for everyone else :-( Please send me email so I can add you manually!

Cheers, Axel.