Re: [pygccxml-development] low level vs high level API
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2006-03-08 06:11:59
|
On 3/8/06, Allen Bierbaum <al...@vr...> wrote: > >2. You needed some search algorithm with power of customization of > >search criteria, right? > > I took Matthias ideas and some code and added it to pygccxml.declarat= ions > > The first place user will look at, in order to see how can he find > >some declaration, am I > > wrong? > > > > > I am not so sure about this one. I think the goal of the high-level API > should be that the first and generally only place the user looks is the > high-level API. That is really the key to having a domain specific > language, you want the user to only have to use it to do everything they > commonly need to. Now to implement that language/interface we could and > will use code from throughout the codebase. At least that is the way I > see it. comments? I knew, that this is the point, that confuse you and Matthias, right? Here are my thoughts: I think that small understanding of pygccxml/declarations package is a must for some advanced functionality, For example even to find all declarations by access type he need to go to declarations package documentation/source code, right? From the other side you can put all functionality you need in order to implement high level API in in module/package. This will get a little bit messy, an user will get lost quickly. Example: pypp_api.DeclWrapper.findContainedMethod do you think that user wants to se= e the implementation of the method? I doubt. Also filters is a new concept, but high level API can hide/show it. For example: next code is taken from "for test only" version of pyplusplus def namespace( self, *arguments, **keywords ): if len( arguments ) =3D=3D 1 and not keywords and is_callable(argum= ents[1]): return decls_package.matcher.get_single( arguments[0], self.declarations ) else: matcher =3D decls_package.namespace_matcher_t( *arguments, **keywords ) return decls_package.matcher.get_single( matcher, self.declarations ) I think that code is really easy to understand and more important is how user will invoke it: mb =3D modyule_builder_t(... ) details_ns =3D mb.namespace( name=3D=3D'::details', recursive=3DFalse ) As you see you don't have to go and learn filters concept. Also, if user needs some custom logic, he can write something like this: details_ns =3D mb.namespace( lambda decl: ..... ) I think this is really simple approach, but I could be wrong. > >3. You needed multi-declaration wrapper, right? > > It took me few days to find out how can we use Python, in order to > >provide best > > implementation to the class. > > > > > > > This one surprised me a little because I did not know I needed it. :) > > I think the fact that we didn't understand your goal for the *_wrappers > really caused some confusion about what the goal is for everything > else. As it stands now even I am not sure if we really need the > multi-decl wrapper in the pyplusplus code. Instead we may just need > something like it in the high-level API which is where the code will be > for querying the declarations anyway. Sorry, but I don't understand last question :-(. Does it really metter where you write the code? If you need something like mulit-decl wrapper in high level API why don't you use the one I created? > -Allen -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |