Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #127 Source code inclusion

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

void foo()
{
#include "foobody.txt"
}
(def foo (load-file "foobody.txt"))
void _foo() {
#include "foobody.txt"
}
void foo()
{
    mixin(import("foobody.txt"));
}
function foo()
include "foobody.txt"
end function foo
import { readFile } from 'fs/promises';
const foo = new Function(await readFile('foobody.txt'));
function foo(): void
{
    include 'foobody.txt';
}
procedure foo;
begin
  {$I foobody.txt}
end;
sub foo {
    do './foobody.txt';
}
import imp
foo = imp.load_module('foobody', 'foobody.txt').foo
def foo
  eval File.read "foobody.txt"
end
fn main() {
    include!("foobody.txt");
}

New implementation...
< >
MLKo