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

A suggestion for cleaner jac imports #1409

Open
eldonm opened this issue Oct 28, 2024 · 0 comments · May be fixed by #1482
Open

A suggestion for cleaner jac imports #1409

eldonm opened this issue Oct 28, 2024 · 0 comments · May be fixed by #1482
Assignees
Labels
jaclang Issues related to jac programming language jivas Issues of high priority to the Jivas Product

Comments

@eldonm
Copy link
Collaborator

eldonm commented Oct 28, 2024

Summary

I have a request for the importer to use './' as the default base_path if the dots ('.', '..', '...') do not precede the module name string so as to allow for cleaner module paths relative to the base path of the root project folder and not the source file itself.

Examples

Consider the folder structure:

root_folder/
├── agent/
│   ├── action/
│       └── exit_interact_action.jac
│       ├── contrib_action/
│           └── contrib_action_graph.jac

Desired import statement from 'contrib_action_graph.jac'

import:jac from agent.action.exit_interact_action { ExitInteractAction }

Compatible import statement from 'contrib_action_graph.jac'

import:jac from ..exit_interact_action { ExitInteractAction }

Both of these should work, however, the first example is proposed and should have the importer use the base_path of the project root in the event no preceding '.' or '..' or '...' is found.

Why do we need this

  1. Relative paths in larger Jaclang projects are tough to keep track of and manage. Mistakes are easily made with the number of dots required to relatively navigate folder depth.
  2. In the case above, we plan to allow contributors to build and publish action modules for use within a larger jaclang program. In this case, it wold be preferred they use cleaner import paths for core jac files that are NOT relative to the module sourcefiles they are contributing.
@ChrisIsKing ChrisIsKing added jivas Issues of high priority to the Jivas Product jaclang Issues related to jac programming language labels Nov 19, 2024
@AshishMahendra AshishMahendra linked a pull request Dec 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jaclang Issues related to jac programming language jivas Issues of high priority to the Jivas Product
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants