Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #127 Source code inclusion

Import the source code for the function foo body from a file "foobody.txt".

void foo()
{
    mixin(import("foobody.txt"));
}

importExpression creates a string from a file.
mixinExpression turns a string into source code.
void foo()
{
#include "foobody.txt"
}

Same as C++

New implementation...
< >
MLKo