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

Enums

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



Joined: 06 Feb 2007
Posts: 55

PostPosted: Tue Jan 15, 2008 3:19 pm    Post subject: Enums Reply with quote

How does MiniD interact with Enum values? I'm having quite a hard time getting it to work... Do I need to wrap everything to use integers instead of enums like this?

Enum E{
One = 1
}

void f(E e) {}

// MiniD function
void MDf(int e) { return f(cast(E)e); }

or am I just being stupid now?
Back to top
View user's profile Send private message
JarrettBillingsley



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

PostPosted: Tue Jan 15, 2008 6:07 pm    Post subject: Reply with quote

Ugh. I thought you could but I guess all the functions I ever wrapped that "took" enums in reality took a uint. All that really needs to be changed is the type detection in MDValue should see if the base type is in integer/float/whatever instead of the type itself (since enums are, in reality, a typedef).

Long story short it's not a big change, I'll put it in MD2 (beta should be out soon..)

As for the enum itself, you'll have to wrap it manually. I usually use WrapModule.custom with an MDTable as the value. Irritating, but D doesn't provide any compile-time enum introspection capabilities Razz
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