Ben Collins-Sussman <sussman@collab.net> writes:
> Kristian Hogsberg <hogsberg@users.sf.net> writes:
>
> > Yeah, I realize the SWIG bindings are easier to maintain, but I looked
> > at the python bindings and I wasn't too impressed. The subversion C
> > API appears to be object-oriented C, in much the same way as the Gtk+
> > toolkit,
>
> Huh? There ain't no C objects anywhere in subversion. We have no
> "classes" or "inheritance" the way GTK does. We just have some tables
> of functions and opaque contexts.
I didn't mean to say that subversion has a complex oo-runtime with
inheritance, virtual functions or signals or whatnot, just that the
APIs seems to follow the same conventions about function naming and
parameters. When a group of functions operate on the same "opaque
context" they are all named with a common prefix and take the context
as their first parameter, e.g.:
svn_error_t *svn_fs_make_dir (svn_fs_root_t *root,
const char *path,
apr_pool_t *pool);
svn_error_t *svn_fs_delete (svn_fs_root_t *root,
const char *path,
apr_pool_t *pool);
unless a function returns data, in which case the return arguments
precede the context argument. Whether or not this is object oriented
is another discussion, but my point was that bindings for a
object-oriented scripting lanugage should take advantage of this
convention and provide a python class such as svn.fs.Root with methods
make_dir and delete so you could say:
root.make_dir("branches/2.7", pool)
root.delete("README~")
which is what I think the ruby binding does.
best regards,
Kristian
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 1 18:55:45 2003