[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ROOT as A replacement for gnuplot



Hi Kevin,

"Kevin B. McCarty" <kmccarty@Princeton.EDU> writes:

> Out of curiosity (sorry for the sidetrack), why do you say
> "unfortunately"?  You just don't like C++ being used as a scripting
> language, or some other reason?

Yes, my snarky comment was mostly based on the design decision of
using C++ as both the scripting and interactive command line language.
It's something that is often debated in ROOT circles and I can see the
pros and cons but personally feel the latter strongly outweigh the
former.

As Christian mentions, the implementation of CINT is also not the
nicest (although it is clear that Masa has worked very hard on this
very hard problem, so I don't mean any disrespect).  Having found
myself there a couple of times I pitty anyone that discovers a SegV
buried inside CINT's library and must track it through all the twisty
passages.  There is also the stange idiom of doing version control in
the code itself.  It is littered with CPP macros like "#ifdef
G__OLDIMPLEMENTATION1616".

That is the source code, but there is also the problem of CINT not
being a true C++ implementation.  For example, one doesn't need to
declare variables, stack based objects don't always destruct correctly
and scope is not always handled correctly.  ROOT adds another quirk
with a behind-the scenes object namespace that "leaks" out into
interpreted code.  Eg, if one creates a histogram with a ROOT name
"h1", it is available in interpreted code as a pointer-to-hist-object
variable named h1.  These end up being "gotchyas" and lead new C++
programmers (which make up a large number of ROOT's users) into bad
programming habbits.

On the bright side, it would be a fairly easy project to come up with
a nicer interactive/scripting language on top of CINT.  Even if this
took the form of a set of C++ based functions that hide away a lot of
the complexity of managinng all the ROOT objects.  Thus the suggestion
for writing a gnuplot-like interface on top of ROOT.

There is also a Python interface that is quite promising and already
very useable.  It is essentially a transliteration of ROOT C++ objects
into Python ones so it inherits many of the design "issues" (good and
bad) but does remove the need to worry about memory management and
CINT language problems.

>> CINT (C/C++ INTerpreter) provides the interactive shell, scripting
>> language as well as the means to introduce reflection to C++ (although
>> this last job will be done by another tool in the near future).
>
> This sounds interesting.  Are you willing to give a sneak preview? :-)

Besides the files for the ROOT implementation that Christian pointed
to, you might be interested in an unrelated project that I once tried
to push on the ROOT team:

http://opencxx.sourceforge.net/

It's even in Debian:

http://packages.debian.org/stable/devel/openc++

-Brett.



Reply to: