On Wed, 2007-05-02 at 02:01 -0700, Erick Tryzelaar wrote:
> I just came across this in flx_stdlib.pak:
> 
> ...
> @h=tangler('lib/flx_platform.flxh','data')
> @select(h)
> #define true case 1 of 2
> #define false case 0 of 2
> 
> @plats = ["WIN32","POSIX","LINUX","MACOSX","CYGWIN","SOLARIS","BSD"]
> @for i in plats:
>   if(eval(i)==1):
>     tangle("#define " + i + " true")
>   else:
>     tangle("#define " + i + " false")
> @#
> 
> macro val true = case 1 of 2;
> macro val false = case 0 of 2;
> ...
> 
> Is there any reason why "true" and "false" are seemingly defined twice?

They're not. The first case is a #define and the second a macro val.
There is no overlap between these: #define's ONLY work
in #preprocessor directives, macros only work in the parse tree
after preprocessing and parsing is finished.

The preprocessor and macro processor share a common set
of evaluation routines for folding constants 
(see src/flx_constfld.ml) and use the same language for
them as Felix as a whole.

However the scopes/environments/text that they're applied
to are strictly disjoint:

#define fred 1
print fred; // undefined symbol fred!

macro val joe = 1;
#if joe == 1 // un #defined  symbol joe


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to