tan
0.0.1
|
Packages are a group of tan source files that share their public and private symbols. Each package is compiled into a single object file and then linked against libraries or other packages.
We can tell the compiler that a source file belongs to a package by adding a global statement:
If this line doesn't exist, the file is treated as a separate package with the filename as the package name.
And src1.tan
and src2.tan
should contain a package "my_package";
statement. However, the compilation won't fail if this is not true, but the source file won't be treated as a part of that package.
Assuming we have a library called dope
and a source file sus.tan
wrote by someone else:
We can import dope
by using the import "dope"
and import sus.tan
using import "sus"
. When the compiler sees them, it will try to find the path to these source files, and import public symbols from them so that they can be used in our own code. During compilation, these files are not compiled. Instead, we link the object files generated from our code to libdope.so
to produce whatever program we want.
The current implementation locate source files of an external package by:
runtime
library)package
statement with the same package nameFuture plan includes configurable mapping between packages and their search paths.
Some soft rules (might change):