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

Constants in MiniD

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



Joined: 21 Oct 2007
Posts: 45
Location: Berlin, Germany

PostPosted: Mon Jan 21, 2008 1:53 pm    Post subject: Constants in MiniD Reply with quote

Hi,
Are there constants in MiniD? I can't find anything about it.
If not, think about it as a new feature Smile
Or would it slow down everything too much?

Mfg Ligustah
Back to top
View user's profile Send private message
JarrettBillingsley



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

PostPosted: Mon Jan 21, 2008 6:40 pm    Post subject: Reply with quote

There aren't, and I kind of doubt it's possible without slowing stuff down..

A constant would basically be a slot somewhere that can be assigned once and no more. A local constant might be possible, but once you start getting into scary flow control stuff the compiler starts getting awfully complex.. a global constant or a constant in an object would be a namespace field which can't be reassigned. That would imply storing not just a value but a (bool, value) tuple for every namespace item where the bool would represent the constness. Reads would skip the bool but writes would check it to ensure that it would be writeable.

Another possibility would be "symbolic constants", which would be indicated syntactically some way, such as "@name". The compiler could build up a list of symbolic constants to look up for a given module/function. Then when the module/function is loaded, it would look up those constants where they're defined and insert those values directly into the constant table of the function (where it would have reserved constant slots in advance). That seems a lot more feasible. Wink
Back to top
View user's profile Send private message
Ligustah



Joined: 21 Oct 2007
Posts: 45
Location: Berlin, Germany

PostPosted: Tue Jan 22, 2008 5:17 am    Post subject: Reply with quote

That sounds good Smile
A seperate constant table... Nice!

Mfg Ligustah
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