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

Binding library..

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



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

PostPosted: Tue Jun 19, 2007 12:07 pm    Post subject: Binding library.. Reply with quote

Just wanted to let you all know that I'm working on the binding library, and it's actually been incredibly simple so far. Poor Kirk has to deal with the horrible PythonC API with Pyd; I've managed to get module and free function wrapping written in about 120 lines of code. It's amazing. You write something like:

Code:
WrapModule!("mod", WrapFunc!(foo), WrapFunc!(bar));


And then in MiniD:

Code:
import mod;
mod.foo();
mod.bar();


I'm so glad I made the core API as template-y as it is, because it's been a cinch so far.

Now the hard part, wrapping classes, comes next. I'm thinking about inheritance and stuff. I'll have to see how Pyd manages some of this.
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Tue Jun 19, 2007 3:34 pm    Post subject: Reply with quote

Maybe class-wrapping in the literal sense shouldn't happen. Instead, provide some sort of lightweight peer/wrapper for MiniD to work with, with a standardized way to enumerate members, etc? Then a template package to make creating those peers simple.

Just an idle thought. For all I know, you have some brilliant means to connect classes directly.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
JarrettBillingsley



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

PostPosted: Tue Jun 19, 2007 9:21 pm    Post subject: Reply with quote

Do you mean, like, generating "shim" classes that the MiniD runtime understands which forward method calls and such to the D class instances? Cause that's how Pyd does it and that's how I'm planning to Wink Not sure if there's really any other sane way.
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Wed Jun 20, 2007 6:03 pm    Post subject: Reply with quote

I really need to write the word "shim" down... I always forget it at times when I could use it. Yes, that is what I meant. It just seems like the easiest way...
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
JarrettBillingsley



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

PostPosted: Fri Jun 29, 2007 7:34 am    Post subject: Reply with quote

OK, so I admit I haven't been working on the binding library that much over the past couple of weeks. A certain very popular MMO has been the main focus of my outside-of-work attention. Damn roommate and his peer pressure.

I have, however, just finished reworking the IO lib and it should be back in play in the next revision. I might upload the revision tonight after some testing, and it'll have the function and module wrapping but no class wrapping yet.
Back to top
View user's profile Send private message
qbert



Joined: 30 Mar 2004
Posts: 209
Location: Dallas, Texas

PostPosted: Sun Jul 01, 2007 4:00 pm    Post subject: Reply with quote

I never remember 'shim' either Razz.

What MMO by chance ?

Also a binding lib will be sweet Smile.
Back to top
View user's profile Send private message MSN Messenger
JarrettBillingsley



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

PostPosted: Sun Jul 01, 2007 4:32 pm    Post subject: Reply with quote

World of Warcraft Smile

I got simple class binding working in about half an hour today Very Happy The real problem, though, is inheritance. That's really tricky.
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Mon Jul 02, 2007 1:31 pm    Post subject: Reply with quote

Very awesome. (I've been losing bits of my life to Flyff -- a small time MMO -- lately, so I can relate.) Is it inheritance on the D side that's causing problems, or on the MiniD side? (ie, is it that D class Bar might be :Foo, or that MiniD class might be :[native]Foo?)

I almost wonder if UserType should have remained for corner cases. That said, I'm dreaming up plenty of uses for MiniD. Such as server scripting a-la PHP or Live.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
JarrettBillingsley



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

PostPosted: Mon Jul 02, 2007 9:01 pm    Post subject: Reply with quote

Quote:
Is it inheritance on the D side that's causing problems, or on the MiniD side? (ie, is it that D class Bar might be :Foo, or that MiniD class might be :[native]Foo?)


Both. It's a bit tricky to get multiple D classes that have been wrapped to work themselves into a MiniD class hierarchy, and the issue of MiniD classes deriving from D classes requires some more thought. Though Pyd solves both of these, so I don't think it's impossible Wink

Quote:
I almost wonder if UserType should have remained for corner cases.


Something I've been toying with (won't make it into MiniD 1.0; too much of a departure from the current design) is a new type system that would be more like Python, where you can basically make a new type that's supported by the VM just as well as, say, Array or Int (well, almost -- just not optimized as well). This would make user types much more flexible, but requires a lot of redesign, and depending on how things work out, may not make it into MiniD, since it's supposed to be a small language, not a do-all language like Python.

In the meantime though, I think classes can fill most of the gaps. The UserData type wouldn't have even had as many features as classes, so they might not have filled the gaps anyway. I also plan on making another baselib class, Blob, which will basically be like a StringBuffer (mutable and resizable) but for arbitrary binary data. This could function as another way to share data between native and script code, such as exposing a struct to MiniD or something like that.
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