Re: [Ctool-develop] little fixes
Brought to you by:
flisakow
From: Stefan S. <se...@sy...> - 2003-08-09 19:32:53
|
Steven Singer wrote: > Shaun Flisakowski wrote: > >> It sounds to me like we're basically in agreement here. My plan going >> forward is to, for example, take the time to add accessors to all >> classes I work on, without making the members private. So, the old >> API continues to work while a better one is available. > > > I'm not convinced that accessors gain us much. The synopsis AST API (http://synopsis.sf.net) uses accessors for all types to access the members. Yet I'm pondering to replace them all with simple (public) variables. Of course, we are talking python here, so the object model isn't quite the same as in C++, but the basic idea is similar: The AST nodes seem to me to be basically data, with no or minimal behavior. Especially by means of the visitor pattern all behavior could be factored out into external classes, so the only bit of polymorphism that has to remain in the AST nodes is the dispatching mechanism, i.e. the 'accept()' implementation. By the way, my main interest into ctool is to hook the AST up with synopsis. Synopsis was originally developed as a source code documentation tool similar to doxygen, but it is quite a bit more powerful. For example another developer added cross reference support to it similar to lxr (http://lxr.linux.no/) so you can inspect not only declarations, but any expressions. Right now this tool (we call it sxr) is only available with the C++ parser, but I'd like to provide the same with C (using ctool). For examples, have a look at http://synopsis.sourceforge.net/demo/index.html... I wonder what you think of pushing that idea even further, i.e. making synopsis (python) modules that are basically scripting frontends to the ctool library as a whole, i.e. also stuff like call graph inspection. Regards, Stefan |