[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: what is a baton?

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2002-07-10 20:20:28 CEST

Justin Erenkrantz <jerenkrantz@apache.org> writes:

> On Wed, Jul 10, 2002 at 02:12:47PM -0400, Scott Lenser wrote:
> >
> > Maybe I'm being stupid, but could someone clue me in as to what a baton is?
> > I could find anything useful in the headers, docs, or web. Is it like a
> > handle or a token or what? I've seen a lot of things programming over the
> > years but seem to have missed this one somehow.
>
> Join the club. I was scratching my head until I sat down and looked
> at the code.
>
> Basically, it is a structure that is passed down into other
> functions that has a lot of "stuff" in it that those functions
> use. In short, it's just a form of encapsulation.

Most C APIs have "void *userdata" all over them. It's the same idea.

> A relay race's baton is probably the best analogy. -- justin

Yes, Jim Blandy made up the term in the early days of subversion. He
invented it when he came up with the Editor interface. The idea was
that each editor call would "pass a baton" to the next one.
(open_dir() creates a dir_baton, which is passed into open_file(),
etc, which creates a file_baton, which is passed into apply_txdelta(),
and so on.)

Afterwards, we just started using the term 'baton' to refer to any use
of opaque userdata. :-)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jul 10 20:24:55 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.