Re: Signature matching, manual intervention.

"Roman Yakovenko" <[email protected]>
Newsgroups gmane.comp.lib.boost.langbinding
Message-ID <[email protected]>
On 8/7/07, Rene Rivera <[email protected]> wrote:
> So I was talking with JW (John W. since there are two Johns I keep
> having to refer to)  and he asked a rather simple question when I was
> mentioning the Luabind signature matching:
>
>    How can you choose a particular overload to call, if you know which
> one you want?
>
> In particular the example he cited was of having two methods overloaded
> on different subclasses of a common class. So my almost immediate answer
> was:
>
>    You can't, since you'll get an error in C++ anyway.
>
> But then I realized that one can, with some clever casting, and function
> pointer. So my question now is:
>
>    Should forcing a call to a specific overload be supported?

I think I don't completely understand you. Do you mean from the
"target" language ( Python or Lua for example )?

If so, than in my opinion the answer is: yes.
Use case:

void do_smth( bool )
void do_smth( int )

Today Boost.Python selects what function to call based on registration
order. The final user has no way to select the right function.

Another very important use case is error reporting. There are too many
times I found myself and other users in situation where I try to
understand why Boost.Python rejects to call one of the exposed
overloaded functions. If you provide the way to specify what function
to call the error report could be very very concrete, instead of
"unable to find function, which takes the arguments you pass" or
something like this.

> And the obvious follow up: How?

May be by allowing lang-binding user  to define alternative name?

def( "do_smth"
       , "do_smth_that_takes_5_arguments"
       , .... );

Thus the extension user will be able to specify directly what function to call.

import my_extension

my_extension.do_smth_that_takes_5_arguments( .... )


-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.