Open HuseyinSimsek7904 opened 4 months ago
Wouldn't this cause a problem with recursive include
statements? You'd need
#pragma once
+ this seems like it would cause complex source files to have unreasonably large include sections.
For example, in the scenario you presented wouldn't the user also need to include linux_x86/stdio.corth
too?
// main.corth
include "library2.corth"
include "linux_x86/stdio.corth"
proc main int int -> int in
hello-world
end 0 end
since puts
is in linux_x86/stdio.corth
and hello-world
depends on it.
Let's imagine a scenario:
File library1.corth:
File library2.corth:
File main.corth:
In this program, main.corth is trying to call the
hello-world
procedure which is inside library1.corth. Compiler allows this behavior because library2.corth includes library1.corth. C/C++ compiler also allows this. However this is an unwanted "feature", because in Corth, every source file should include the source files that it needs and only the source files that it needs. So the compiler should to complain, or at least create a warning about this situation.