View previous topic :: View next topic |
Author |
Message |
vektorboson
Joined: 14 Sep 2006 Posts: 44
|
Posted: Mon Dec 14, 2009 1:20 pm Post subject: Problem with the binding library |
|
|
There's a problem with the binding library, specifically with class-wrapping. The WrappedClass should global escape all functions it is calling, otherwise it'll try to call functions that are defined within the wrapped class. In my case it was the isNull-method on which WrappedClass was choking.
Code: |
class MyClass {
bool isNull() { return true; }
}
void registerLib(MDThread* t) {
WrapModule!("foo",
WrapClass!(MyClass, "MyClass"))(t);
}
|
Since WrappedClass!(MyClass, ...) inherits MyClass, it also uses the isNull-method from MyClass. This can happen for every other method, so best is to prefix all function-calls with '.' within WrappedClass. |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Mon Jan 25, 2010 6:54 am Post subject: |
|
|
GAAAH
I hate the binding library so hard XD |
|
Back to top |
|
|
vektorboson
Joined: 14 Sep 2006 Posts: 44
|
Posted: Sun Sep 19, 2010 2:31 pm Post subject: |
|
|
JarrettBillingsley wrote: | GAAAH
I hate the binding library so hard XD |
It seems the much hated binding library is broken with the latest Tango-svn.
Out of interest: Did you abandon MiniD/D or is it still maintained/supported? |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Mon Sep 20, 2010 8:33 am Post subject: |
|
|
It seems that everything is always broken with the latest Tango-svn. This is why I haven't been keeping MiniD up-to-date. I've become rather disillusioned with D. |
|
Back to top |
|
|
vektorboson
Joined: 14 Sep 2006 Posts: 44
|
Posted: Mon Sep 20, 2010 11:56 am Post subject: |
|
|
JarrettBillingsley wrote: | It seems that everything is always broken with the latest Tango-svn. This is why I haven't been keeping MiniD up-to-date. I've become rather disillusioned with D. |
I understand your frustration. I find myself wishing to dump D over and over again.
I asked just because you stated somewhere you wanted to keep MiniD in sync with Tango-SVN, instead of 'stable' Tango.
Best regards! |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Mon Sep 20, 2010 6:05 pm Post subject: |
|
|
vektorboson wrote: | I asked just because you stated somewhere you wanted to keep MiniD in sync with Tango-SVN, instead of 'stable' Tango. |
And then I realized that no matter what version of Tango you target, it will always be the wrong one. Because everyone's using a different one.
Tango is an untargetable, unstable mess; Phobos 1 is underfeatured and unused; and D2/Phobos 2 are just .. stunning. In a bad way. In an "oh my god how badly-written IS this compiler" way. In a "jesus christ was any thought given to simplicity in this standard library" way.
Sighhhh. |
|
Back to top |
|
|
vektorboson
Joined: 14 Sep 2006 Posts: 44
|
Posted: Wed Sep 22, 2010 9:09 am Post subject: |
|
|
I hope I'm not pushing the wrong buttons, but I need to ask since I'm about to expand the coupling of my game engine with MiniD: Do you think you'll touch D (whichever one) and MiniD again in the future, or should this project be considered abandoned? |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Wed Sep 22, 2010 4:32 pm Post subject: |
|
|
I'm not against working on MiniD again. If there's anything that you need fixed, or if you have any ideas or suggestions, feel free to make a ticket. You can even attach patches. I've mostly run out of things to work on, and given that there are maybe one or two people using the language, there's not a lot of activity, period. No one files bug reports cause no one is using it. So.. yeah. |
|
Back to top |
|
|
vektorboson
Joined: 14 Sep 2006 Posts: 44
|
Posted: Fri Sep 24, 2010 5:54 am Post subject: |
|
|
JarrettBillingsley wrote: | I'm not against working on MiniD again. If there's anything that you need fixed, or if you have any ideas or suggestions, feel free to make a ticket. You can even attach patches. I've mostly run out of things to work on, and given that there are maybe one or two people using the language, there's not a lot of activity, period. No one files bug reports cause no one is using it. So.. yeah. |
Aside from Python, I think MiniD is one of the nicest scripting languages (and a better API than Python). It's the programming language platform which hinders MiniD's success...
Speaking of API: I'd like to implement some kind of preemptive scheduling; in my case it would be yielding a MDThread after a certain amount of MiniD-instructions are executed. I see that I can use setHookFunc with Delay; but what should I use to suspend the MDThread? Should one use yieldImpl, and how?
Thanks for your support! |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Fri Sep 24, 2010 4:11 pm Post subject: |
|
|
You won't be able to use setHookFunc to do the preemption, because you wouldn't be able to yield correctly out of the execute() function. However, you could make the preemption happen at the same place as where the hooks are called in execute(). I'm thinking something like...
Code: |
if(t.hooksEnabled)
{
// ...
}
if(t.preemptEnabled)
{
t.preemptCounter--;
if(t.preemptCounter == 0)
{
t.preemptCounter = t.preemptDelay;
version(MDExtendedCoro)
yieldImpl(t, t.stackIndex, 0, 0);
else
{
if(t.nativeCallDepth > 0)
throwException(t, "Attempting to yield across native / metamethod call boundary");
t.savedCallDepth = depth;
yieldImpl(t, t.stackIndex, 0, 0);
return;
}
}
}
|
That is, you're going to do a zero-value yield if the preemption counter reaches zero, similar to how the delay hook works. Notice how it returns from execute() if we're not using the extended coroutines -- this is the behavior that you can't get with the hook funcs.
I think this should work. I don't think there needs to be anything special for yieldImpl to work right, or for the thread to be resumed correctly. Try it and see if it breaks! |
|
Back to top |
|
|
vektorboson
Joined: 14 Sep 2006 Posts: 44
|
Posted: Mon Sep 27, 2010 11:59 am Post subject: |
|
|
Your code-snipped worked correctly, though I needed to move it to a different position. I've put it in between here
Code: |
if(t.shouldHalt)
throw new MDHaltException;
if(t.preemptEnabled) {
...
}
pc = &t.currentAR.pc;
Instruction* i = (*pc)++;
|
If I preempt after the program counter is increased, one instruction is skipped and the MDThread stops working.
Thanks for your support! |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Mon Sep 27, 2010 6:40 pm Post subject: |
|
|
Ah right, that's a good point X) Glad it worked! |
|
Back to top |
|
|
|