[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: Newer xsubpp



On Sun, Jan 23, 2000 at 11:18:00PM +0000, Tim Bunce wrote:
> I recently implemented a Perl API to a C++ library that had lots of
> "out" and "inout" parameters. I chose to use "pass by alias" (for want
> of a better name) and thus the Perl API looked _exactly_ like the C++
> one to the point of being able to use the same documentation.
> 
> It would have been very 'unnatural' and unwieldy in this case to have a
> bunch of out parameters returned as a list along with the method return
> status.

The method return status should not be returned at all.  One can
always croak/return-empty in a postcondition.

> Updating the arguments 'in place' made the API very neat and
> simple to use.

This is already simple with the current (messy) API.

> I guess my point, now I've thought about it some more, is that three
> forms of "out" should be provided with unambiguous names.
> 
> One meaning "return this value via the 'result' of the function",
> another meaning "return this value by updating the dereferenced argument",
> and a third meaning "return this value by updating the argument directly".

Good point.

Ilya


References to:
Ilya Zakharevich <ilya@math.ohio-state.edu>
Gurusamy Sarathy <gsar@ActiveState.com>
Tim Bunce <Tim.Bunce@ig.co.uk>
Ilya Zakharevich <ilya@math.ohio-state.edu>
Tim Bunce <Tim.Bunce@ig.co.uk>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]