FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with the binding library

 
Post new topic   Reply to topic     Forum Index -> MiniD
View previous topic :: View next topic  
Author Message
vektorboson



Joined: 14 Sep 2006
Posts: 44

PostPosted: Mon Dec 14, 2009 1:20 pm    Post subject: Problem with the binding library Reply with quote

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
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Mon Jan 25, 2010 6:54 am    Post subject: Reply with quote

GAAAH

I hate the binding library so hard XD
Back to top
View user's profile Send private message
vektorboson



Joined: 14 Sep 2006
Posts: 44

PostPosted: Sun Sep 19, 2010 2:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Mon Sep 20, 2010 8:33 am    Post subject: Reply with quote

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
View user's profile Send private message
vektorboson



Joined: 14 Sep 2006
Posts: 44

PostPosted: Mon Sep 20, 2010 11:56 am    Post subject: Reply with quote

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
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Mon Sep 20, 2010 6:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
vektorboson



Joined: 14 Sep 2006
Posts: 44

PostPosted: Wed Sep 22, 2010 9:09 am    Post subject: Reply with quote

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
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Wed Sep 22, 2010 4:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
vektorboson



Joined: 14 Sep 2006
Posts: 44

PostPosted: Fri Sep 24, 2010 5:54 am    Post subject: Reply with quote

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
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Fri Sep 24, 2010 4:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
vektorboson



Joined: 14 Sep 2006
Posts: 44

PostPosted: Mon Sep 27, 2010 11:59 am    Post subject: Reply with quote

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! Very Happy
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Mon Sep 27, 2010 6:40 pm    Post subject: Reply with quote

Ah right, that's a good point X) Glad it worked!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MiniD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group