I added some code to make this work: //////////////////////////// #import <flx.flxh>
_tokdef mymac = 1,2 _edef val x = mymac; print x.(0); print " "; print x.(1); endl; ///////////////////////////// The construction _tokdef ident = token ... _edef defines ident to be the list of tokens after the = sign, and prior to the word '_edef'. Whenever such a name is seen, it is replaced by its definition, so val x = mymac; expands to val x = 1,2; This processing is done BEFORE parsing. The scan for a _tokdef is not expanded, however when a name is replaced by a token list, the list is pushed back into the input and rescanned. This feature can be used to work around the fact the syntax preserving macro processor cannot expand all Felix constructions: it works with expressions, statements and types, but not in other places such as parameter lists, even though these are well formed subtrees. I implement this so I could write: _tokdef mints = tint, short, int, long, vlong; ctypes mints; typedef ints = typesetof (mints); for val t in (mints) do open Eq[t]; done; without having to repeat the list of types. Definitions are scoped over the whole token stream. Try to avoid this feature!! It is basically a slightly better version of C macro processing, and thus has all the problems of such systems. I will, however, enrich it so it can do a bit more than just simple name replacement. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language