My understanding is that `include` is like `template` but for file: in-place code replacement, just like C `#include`. I broke my big file into small includes, and now inapprehensible errors pop up... This example presents the reverse of what I see with my code: big file compiling while includes don't.
**myinclude.nim** type A = object str: string template conc(s1: A, s2: string): string = s1.str & s2 Run **foo.nim** template foo*(sFoo: untyped) = block: include myinclude template bar(sBar: untyped) = echo "In bar" sBar echo "In foo" sFoo echo "completed foo" foo: bar: echo conc(A(str: "hello"), "world") Run This compiles and outputs In foo In bar helloworld completed foo Run Now, if instead of including the file, I copy its content replacing the `include myinclude`, to get **foo.nim** template foo*(sFoo: untyped) = block: type A = object str: string template conc(s1: A, s2: string): string = s1.str & s2 template bar(sBar: untyped) = echo "In bar" sBar echo "In foo" sFoo echo "completed foo" foo: bar: echo conc(A(str: "hello"), "world") Run It does not compile anymore, with `Error: undeclared identifier: 'A'` What does `include` do exactly? _Also as a side note, if you don 't declare the type ``A``, Nim compiler optimize the string concatenation and both versions compile..._