Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some generic version failures #19

Open
sonoro1234 opened this issue Apr 29, 2020 · 1 comment
Open

Some generic version failures #19

sonoro1234 opened this issue Apr 29, 2020 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@sonoro1234
Copy link
Owner

sonoro1234 commented Apr 29, 2020

Generic version is still experimental
Its purpose is to detect the overloaded version from arguments
Here are some failing cases

from implot

M.PushPlotStyleVarFloat = lib.igPushPlotStyleVarFloat
M.PushPlotStyleVarInt = lib.igPushPlotStyleVarInt
function M.PushPlotStyleVar(a1,a2) -- generic version
    if (ffi.istype('float',a2) or type(a2)=='number') then return M.PushPlotStyleVarFloat(a1,a2) end
    if (ffi.istype('int',a2) or type(a2)=='number') then return M.PushPlotStyleVarInt(a1,a2) end
    print(a1,a2)
    error'M.PushPlotStyleVar could not find overloaded'
end

It is imposible to discriminate float from int when it is a Lua number. In this cases generic version cannot be used and overloaded name should be used.

Trying to work a solution, suggestions are welcome.

@sonoro1234 sonoro1234 added the help wanted Extra attention is needed label Apr 29, 2020
@sonoro1234
Copy link
Owner Author

In order to avoid using overloaded name solution can be giving second argument as CDATA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant