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

MiniD Feature Freeze -- Now in effect!
Goto page Previous  1, 2
 
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: Thu May 17, 2007 6:17 pm    Post subject: Reply with quote

That's kind of approaching how the API will be laid out, I think. See, it would be really nice to be able to do:

Code:

MDValue a = 3;
MDValue b = 6;
MDValue c = a * b;
MDValue d = new MDArray(5);
d[0] = a;
d[1] = b;
d[2] = c;


But the problems with this are (1) what about metamethods? What if I were doing this on other types which had metamethods defined? and (2) what MDState should be used if there's an error, or to call metamethods if that gets ironed out?

One alternative is a Lua-like API, but that's pretty awful.

So I've been thinking of something like:

Code:
with(s) // s is an MDState
{
   MDValue a = 3;
   MDValue b = 6;
   MDValue c = mul(a, b); // this is a method of s
   MDValue d = new MDArray(5);
   idxa(d, 0, a);
   idxa(d, 1, b);
   idxa(d, 2, c);
}


It's starting to look a bit like the NekoVM FFI. This has the advantages of (1) being pretty clean, much cleaner and more straightforward than the Lua API certainly, (2) allowing for metamethods, and (3) having a state for calling metamethods and throwing errors.
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
Goto page Previous  1, 2
Page 2 of 2

 
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