I thought about adding some sort of #pragma once equivalent to the assembly language, but it occurs to me that I might really want the default behaviour of .include to only include the file once, regardless of how many times it is included. This solves a host of issues, including problems with recursive includes. It also means that you don't have to remember to annotate your file in some special way in order to get it to only be included once.
Some thought needs to be put into how we decide which include to expand. For example, we can get wildly different results if our include process is breadth-first vs. depth-first. We probably want breadth-first because then we will favour expanding includes that are found earlier in the include resolution process. That means that if you have a bunch of includes in your main file, but also repeat those includes elsewhere to indicate dependencies, only the includes in the main file will be expanded to something.
We should also consider having some sort of syntax for explicitly including a file multiple times. Having the syntax on the .include directive makes the behaviour configurable. If we used something like #pragma once, we would always be limited to the behaviour configured in the file and it would be more difficult to override that.
I thought about adding some sort of
#pragma onceequivalent to the assembly language, but it occurs to me that I might really want the default behaviour of.includeto only include the file once, regardless of how many times it is included. This solves a host of issues, including problems with recursive includes. It also means that you don't have to remember to annotate your file in some special way in order to get it to only be included once.Some thought needs to be put into how we decide which include to expand. For example, we can get wildly different results if our include process is breadth-first vs. depth-first. We probably want breadth-first because then we will favour expanding includes that are found earlier in the include resolution process. That means that if you have a bunch of includes in your main file, but also repeat those includes elsewhere to indicate dependencies, only the includes in the main file will be expanded to something.
We should also consider having some sort of syntax for explicitly including a file multiple times. Having the syntax on the
.includedirective makes the behaviour configurable. If we used something like#pragma once, we would always be limited to the behaviour configured in the file and it would be more difficult to override that.