Oberon00 / luabind

Luabind is a library that helps you create bindings between C++ and Lua.
http://oberon00.github.io/luabind/
Other
46 stars 13 forks source link

Failing unit test: "out_value" vs. "pure_out_value" #30

Open Bertram25 opened 9 years ago

Bertram25 commented 9 years ago

As reported here: https://github.com/Oberon00/luabind/pull/29#issuecomment-134530745

@fhoefling there is at least one failing test concerning "out_value" vs. "pure_out_value", see commit https://github.com/Oberon00/luabind/commit/a1199b51bc1b6af5cf7e6a5cfba021c4cacb1a78

Oberon00 commented 9 years ago

[OT: I was baffled at first because your link to the commit (automatically created by github) points to https://github.com/Oberon00/luabind/commit/a1199b51bc1b6af5cf7e6a5cfba021c4cacb1a78 and I thought "Where is this commit gone?" but it seems that git locates the commits by ID for any fork, no matter which fork you use in the URL, e.g. try https://github.com/luabind/luabind/commit/4274bb6f347d23f3bc8f2dee106b0d01f97.... ]

Oberon00 commented 9 years ago

Seems complicated to fix as some converters are stateful and rely on e.g. match being called before apply (see for example https://github.com/Oberon00/luabind/blob/master/luabind/detail/policy.hpp#L217). However, to instantiate the appropriate converter, the out value converter would need to know which ‒ but it learns that only once match is called at runtime! Honestly, I think this design is broken. But a workaround to fix this withouth greater modifications, would be to introduce a type erased wrapper for the converter (exchanging the Ts per void*) and instantiating that in match.

mrgreywater commented 8 years ago

see https://github.com/rpavlik/luabind/commit/42b8219486a0f7b3509493e3a1435e1289d2f7da

Honestly, I would love to see your two forks merged, Isn't it kindof counter productive to manually cherry pick commits from each others fork?

Oberon00 commented 8 years ago

Have you read my above comment about stateful converters? The current test is insufficient to catch this error. Try using a class-type as out-value parameter and I bet you get an access violation.

And regarding mine and @rpavlik's fork being merged: I think neither of us is against that idea, but it would be a lot of work and at least I do not want to spend too much time on luabind anymore.