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

Re: Context parameter in public API

From: Nuutti Kotivuori <naked_at_iki.fi>
Date: 2002-10-11 13:37:15 CEST

Karl Fogel wrote:
> Nuutti Kotivuori <naked@iki.fi> writes:
>>> So, how about adding a context parameter to every function? I
>>> know that's a big change, but I think we'll be forced to do that
>>> sooner or later anyway.
>>
>> Er um er. My knees are already shaking. Every function? :-)
>>
>> I think someone more knowledgeable than me should define a bit more
>> carefully what indeed is 'every' function - and how the whole thing
>> should be handled.
>
> Why don't we start by adding it to the call paths where we actually
> need it this time? That'll probably teach us something, then we can
> decide about other paths...
>
> And when I say "we", I mean Nuutti, of course :-).

OK, let me think this over a bit - a context parameter. How I
understand what that would mean is that the svn_client library has a
context, which is to be first opened, then passed to every function
called from the library, and then closed at the end. And that context
would be opaque to users of the client library. Roughly as pseudocode:

 svn_error_t *svn_client_context_open(svn_context_t **ctx);

 svn_error_t *svn_client_context_close(svn_context_t *ctx);

And in usage, for example:

 svn_error_t *
 svn_client_ls (apr_hash_t **dirents,
                const char *url,
                svn_opt_revision_t *revision,
                svn_client_auth_baton_t *auth_baton,
                svn_boolean_t recurse,
                apr_pool_t *pool,
                svn_context_t *ctx);

This sounds reasonable - and fine - and cool. But I'm not sure how to
handle this current problem at hand. Actually it boils down to a
question that must be clear to you but which hasn't really gotten
through to me yet.

Is the 'config' file a feature of svn_client libraries or is it
something that only the command-line client uses?

If it is a part of the svn_client library functionality - then it
sprouts a few more questions. Is svn_time_to_human_nts part of the
svn_client library? I guess it is since it's supposed to be called by
the callers of svn_client library. Does that mean that if the context
is implemented, you cannot call svn_time_to_human_nts without having a
context? How does this affect svnadmin and svnlook which need it too?

Or, on the other hand, if the 'config' file is a part of the cmdline
client - what does the context have to do with anything? Or do you
mean a context in the sense that the commandline client should open
the config file at start and pass it on to its own functions. But how
would the information get to svn_time_to_human_nts then? Additional
parameter perhaps? Again to all callers?

So, I am a bit of a loss here - this is your territory, not mine :-)

-- Naked

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Oct 11 13:38:34 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.