-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import statement #27
Comments
Implement a way to store compiled files so the VM doesn't have to recompile a file every time it's included. Or alternatively, should this be allowed? So you always get a fresh version of the file. The only problem with that would be weird interactions between different versions of the file. Developers would have to account for that themselves though. |
You can do what CPython does with |
@tekknolagi Ah I see, and then if people want to use the newest version they can just delete the file? |
No, it should either compare mtime or compare hashes so that it can automatically detect when it needs to recompile |
I see, so I figure these |
In CPython they contain a marshalled code object plus some magic number and metadata. So you read the file, check the metadata, and unmarshal the code object. The code object has some metadata and a field ( |
Description
import
statements are used to include libraries and other charly source files.Import
import
keyword with an identifier will import that identifierImport from expression
Renamed import
as
keyword can be used to assign the imported library to a different nameImport specific fields
as
keywordfrom
keywordas
syntaxModule resolution
/
)The import statement
import "somelib"
in the file/foo/bar/baz/index.ch
would result in the following filesystem lookups:/foo/bar/baz/somelib
/foo/bar/baz/somelib.ch
/foo/bar/somelib
/foo/bar/somelib.ch
/foo/somelib
/foo/somelib.ch
/somelib
/somelib.ch
Module caching
mtime
of the source fileThe text was updated successfully, but these errors were encountered: