Compiler/Simple file inclusion pre processor: Difference between revisions

→‎{{header|Phix}}: marked incorrect, the penny has just dropped...
m (→‎{{header|Phix}}: duplicate includes)
(→‎{{header|Phix}}: marked incorrect, the penny has just dropped...)
Line 421:
 
=={{header|Phix}}==
{{incomplete|Phix|I rather think I misunderstood the task..<br>}}
Standard feature. Phix ships with a bunch of standard files in a builtins directory, most of which it knows how to "autoinclude", but some must be explicitly included ([http://phix.x10.mx/docs/html/include.htm full docs]). You can explicitly specify the builtins directory or not (obviously without it will look in the project directory first), and use the same mechanism for files you have written yourself. There is no limit to the number or depth of files than can be included. Relative directories are honoured, so if you specify a (partial) directory that is where it will look first for any sub-includes. You can also use single line "stub includes" to redirect include statements to different directories/versions. Note that namespaces are '''not''' supported by pwa/p2js. You can optionally use double quotes, but may then need to escape backslashes. Includes occur at compile time, as opposed to dynamically.
<!--<lang Phix>-->
Line 429 ⟶ 430:
If the compiler detects that some file has already been included it does not do it again (from the same directory, two or more files of the same name ''can'' be included from different directories).
I should perhaps also state that include handling is part of normal compilation/interpretation, as opposed to a separate "preprocessing" step, and that each file is granted a new private scope, and while of course there is only one "global" scope, it will use the implicit include hierarchy to automatically resolve any clashes that might arise to the most appropriate one, aka "if it works standalone it should work exactly the same when included in as part of a larger application".
 
And so on to the task as specified: a "preprocessor" for Phix would fail in so many ways it is simply not worth attempting... oh, the penny has just dropped.
7,795

edits