JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Sat Jan 26, 2008 11:42 am Post subject: Binding Lib Woes, or Why OMF Is Awful |
|
|
OK so in the process of redesigning the binding library for MiniD 2, I've come across a bit of a pickle. You know how the binding library used to use variadic templates to bind everything, but that was a problem because DMDWin's use of OMF restricts symbol length so aggressively that you couldn't bind more than two or three members?
Well guess how the binding lib has to be structured to support polymorphic behavior, i.e. allowing MiniD objects to override native ones and have those MiniD methods called when called on a native object reference?
That way.
See, the new binding lib uses a chained-method approach. This works well for the features it has, but it has a downside: since the binding is done one thing at a time at runtime, the binding lib has no way of knowing at compile time what methods need to/can be polymorphic and can therefore not generate appropriate shim methods. With the variadic templates, the binding lib has all that info at compile time and can do real magic. This is why Pyd is structured this way.
So there's a choice. Either polymorphism is allowed and the damn thing is next to useless on DMDWin, or polymorphism is not allowed and it works on every compiler.
A third option is to have _both_, which is kind of a maintenance nightmare, as well as having two completely different binding syntaxes and two basically incompatible wrapped native object systems. It still doesn't solve the problem of allowing polymorphism on DMDWin.
A fourth option is to try to come up with a fourth option. That is, find some way of designing the binding lib such that it doesn't involve incredibly long identifiers (at least not in the object files), but while still allowing polymorphic behavior. I don't really know if this is possible.
The fifth option is to hold Walter ransom until he fixes this. I don't think that's really possible either. |
|