On Fri, 2007-09-21 at 12:20 -0700, Erick Tryzelaar wrote: > On 9/21/07, skaller <[EMAIL PROTECTED]> wrote: > > At present every Felix 'file' has to #import <flx.flxh>. > > To get rid of this, I'm thinking out loud as usual. > > > > Felix has 4 inclusions: > > > > #include > > #import > > include directive > > compiler accepts multiple file names > > > > #include makes #directives, including #macros, local > > to the file and isolated from the #including file. > > It neither imports nor exports any #macros. > > Now that we have scoped syntax extensions, I'm not sure if macros are > as important as they were before. We could just drop the #include > since I bet they'll be less name collision.
We could, although #include is logically the equivalent of include at the # level: each #include file is independently lexed, and so the token stream produced can be cached to avoid lexing it unless it is changed. If we go to a unicode (32 bit char) lexer this could be important. It's the principle of the thing, that you can split a file into includes, just as you can split a function into smaller ones. However #define .. line1 line2 has to be split into #include 1 #Include 2 #define line1 #define line2 i.e. the #define has to be duplicated, just as when you factor a top level function into several top level functions you have to pass the original function's context to each sub-faction separately. What Python does might be interesting model: Directory X: File _init.flxh File A File B --> #include X/A imports A with X._init glued in the front. so you can define shared stuff in _init.flxh. Then if you say #include X you get the lot. But we might want to use the packaging idea for includes, not #includes .. ouch. > We should keep a flag to flxg that will turn off automatic importing > of flx.flxh though, in case someone wants to write a completely new > syntax. It's the other way: flxg will require flxg --import=flx.flxg std xxx The 'flx' script will default this, so 'flx' will need the flag to turn it off. The flag has been implement for eons and aeons .. it just doesn't do anything (it's actually called 'hash_include' at the moment). -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language