A problem I met before I started working on Chrome was circular references. A circular reference in Pascal happens when both units use the other one in its interface section.
uses File2;type TClass1 = class
type TClass2 = class(TClass1)
In Pascal, the files contain interface and implementation sections. In the interface you declare types, functions, constants that are accessible from outside the file and in the implementation section you declare the implementation of these classes and methods. Generally Pascal compilers are single pass, referring to processing the file once before creating the output. Chrome, However, uses multiple passes over the interface section.
When we talk about a multipass compiler, we generally think about a slow c++ compiler, but multipass doesn’t have to be slow. Chrome doesn’t use header files like c++ does, instead it uses fast readable .Net assemblies as
When compiling, Chrome first reads the interface sections of all files, then goes over them as needed to resolve all types. This gives us advantages over other Pascal implementations.
It makes it possible to spread a namespace over multiple files. Because types are resolved after they are read, there are no dependency errors between the different files. All files are compiled at once.
Also it’s possible to put a single class in each file without having any circular reference problems between the files.