On Sun, Dec 26, 2010 at 8:18 PM, starwing <
weasley.wx@gmail.com> wrote:
> Hi Jose,
>
> thank you to reply :-)
>
> 2010/12/27 Jose Luis Hidalgo <
joseluis.hidalgo@gmail.com>:
>> Hi starwing,
>>
>> On Sun, Dec 26, 2010 at 7:23 PM, starwing <
weasley.wx@gmail.com> wrote:
>>> Does SLB support function overload? it's a useful feature.
>>>
>>
>> Mmm... sorry, but no. The problem is lua type marshaling with C++
>> types, there are many ways a type can be "converted" from lua to a C++
>> function/method signature. Overloading could be possible for different
>> number of arguments, though, but no for different signatures with the
>> same number of arguments, and I didn't want to support partial
>> overloading.
>
> Maybe we can make a typemap table to handle the type conversion
> between lua and C++.
>
>
>>
>> BTW, the search for the proper method to call will add a significant
>> overhead, SLB is meant to be as faster as possible, near to a
>> hand-coded wrapper. What I usually do with overloading is register
>> each function with a different name in lua, which is not as handy as
>> overload support, but it works.
>>
>
> No, It will every fast, In a typical implement, we can store C
> functions into a hash table, the key is the type-signature. so to find
> the right function, we just lookup a hash table, and the global
> variable lookup in Lua is just lookup a hash table. so it can not slow
> than reference a global variable in Lua.
>
> and, If we want, just use a different function in SLB to register
> overloaded function, most function needn't lookup hash table, but if
> we need, we can use it. is it better than no overload support?
>
>
>> Cheers,
>> JL.
>>
>> PS: I'm working on registering accessors to instances' attributes,
>> but, I'm not sure about how use it from lua properly, do you have any
>> insights?
>>
>> --
>> Jose L. Hidalgo Valiño (PpluX)
>> ----
http://www.pplux.com ----
>>
>>
>
>