Re: Conditional includes
- Posted by irv Nov 12, 2010
- 1406 views
OK, here's an abbreviated example:
-- Main.ex include std/dll.e -- user-written files; public include file.e -- handler library, included with every program; include funks.e printf(1,"Main sez routine_id is: %d\n",{routine_id("file:close")})
-- file.e namespace file -- This file would be written by the user, and 'included' in main.ex global function close() -- it's global? puts(1,"File closed\n") return 1 end function printf(1,"File sez routine_id is %d\n",{routine_id("close")})
-- funks.e -- This file is fixed, non-editable. It cannot 'see' the user-written includes, -- but it must access the user-written functions in those includes. export procedure do_fn(sequence s) atom rid = routine_id(s) printf(1,"do_fn sez routine_id is: %d\n",{rid}) --call_func(rid) end procedure -- code here decides which routine will be called. -- based on which button pushed, etc. -- if btn.name = "file_close" then do_fn("file:close") -- as an example
In real life, of course, funks.e would be a much larger file, one which the user would have no business editing.
Apparently, global and public mean something different to programmers than to Webster. Do we need new scope words like Universal and CommonKnowledge?
At any rate - that's what I'm trying to do. IF we could do that (I think it's impossible in Euphoria) it would make for much cleaner, easier to use code (The Glade IDE could, for example, be used to create an entire Eu program)