[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: pcall and xpcal
- From: Philippe Fremy <phil@...>
- Date: Fri, 13 Aug 2004 19:09:06 +0200
On Friday 13 August 2004 14:37, Roberto Ierusalimschy wrote:
> > pcall and xpcall serve the same purpose (calling a function with some
> > special error handling) and one would expect that they have the same
> > arguments.
> They can't, as xpcall needs an error handler. Whatever the solution,
> they could not have the same arguments.
Ah, that's the reason:
pcall( f, arg1, arg2, ... )
xpcall( f, err_handler )
It should not be difficult to turn xpcall into :
xpcall( f, err_handler, arg1, arg2, ...)
That's what I meant by "the same arguments" although you are right that they
are not the same.
It would have probably been better if xpcall had started as:
xpcall( err_handler, f )
where passing the extra arguments to f just after f would have been more
xpcall(err_handler, f, arg1, arg2, ...)
Anyway, does a xpcall( f, err_handler, arg1, arg2, ... ) make sense ? Else,
I am forced to create a local function wrapper that has no argument to wrap
my functions with arguments.
> -- Roberto
An open source OS for contactless Smart Cards
http://www.jayacard.org - Jayacard