Re: No more platform(), conditional includes, conditional functions, condit
- Posted by Shawn Pringle <shawn.pringle at gmai?.co?> May 15, 2008
- 667 views
CChris wrote: > Let me add a short example. > > Following a suggestion, I added task_yield() to the main event loop in > win32lib. > task_yield() is not defined in 2.5 official. How to prevent a crash? > > "Simple", using Shawn's idea: > }}} <eucode> > if version_atom >= 3.0 or equal(version_string,"2.5r3") then > task_yield() > end if > </eucode> {{{ > The idea was 'functions' like platform(): version_atom(), version_string(). No, an example like this would end in a crash with any version except our hypothetical 4.0 or greater. So, there is no point in checking for any version before 4.0. Secondly, in my hypothetical 4.0, the parser would try to evaluate the if expressions as if they were ifdef. Some things can be evaluated before the program gets made into an executable. Consider what is constant when a program is bound: global constants, platform(), these butilin version constants, any expression using these only constants is also a constant. If the boolean expression is 'constant' then the parser evaluates it if not it gets translated into IL code. This puts makes it a whole lot simplier for the user. And yes, it makes it more complicated for you guys who want to implement this stuff but this is starting to look more and more like C here. Can't we do better? Shawn Pringle