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

wrapped object vs null

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



Joined: 13 Sep 2008
Posts: 2
Location: Finland

PostPosted: Fri Mar 13, 2009 4:33 pm    Post subject: wrapped object vs null Reply with quote

The test code below outputs false, which is not what I expected. The d-null is wrapped in a minid object, so it doesn't equal the null type. Should MDValue.opEquals also look inside the wrapper to test for null?

Code:

import minid.api;
import minid.bind;

class Foo {}
Foo GetFoo() { return null; }

void main() {
    MDVM vm;
    MDThread* t = openVM(&vm);
    WrapGlobals!(
        WrapFunc!(GetFoo),
        WrapType!(Foo)
    )(t);
    runString(t, "writeln(GetFoo() is null)");
}
Back to top
View user's profile Send private message
JarrettBillingsley



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

PostPosted: Sat Mar 14, 2009 11:18 am    Post subject: Reply with quote

Oops. I did null-checking when getting params (so passing a MiniD null to a D object reference would work), but not on return values. Just update MiniD Smile
Back to top
View user's profile Send private message Visit poster's website
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