Skip to content
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

Add @-prefixed import section #213

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

sogaiu
Copy link
Contributor

@sogaiu sogaiu commented Feb 4, 2024

This PR is an attempt to address #208.

It adds a section to the Modules page for @-prefixed imports.

The text is close to:

@-prefixed Imports

Starting in 1.26.0, Janet allows importing modules from 
custom directories more easily using the @-prefix in a 
module path.

For example, if there is a dynamic binding 
:custom-modules that is a file system path to a 
directory of modules, import from that directory with:

(import @custom-modules/mymod)

As a special case, it is possible to import from 
absolute paths by prefixing an absolute path with @. 
For example, to import from 
/tmp/custom-modules/mymod.janet, express this as:

(import @/tmp/custom-modules/mymod)

Note that although using absolute paths is possible 
and useful for testing, it is not recommended for 
most production use cases. 

Details of the investigation that factored into the content start in this comment.


There was also some reformatting for making line lengths kinder for folks who don't use (or have trouble using) very wide screens (or multiple displays). This makes it easier to do side-by-side comparisons. If these sorts of edits are a problem, I can undo them.

@bakpakin bakpakin merged commit cfce124 into janet-lang:master Apr 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants