-
Notifications
You must be signed in to change notification settings - Fork 298
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
creating a module is awkward (arbitrary domain name, publishing later) #3620
Comments
@btrepp Thanks for the report!
It's interesting you mention this, because there I've had some private discussions about the fact that the default module name
Unfortunately from my p.o.v. this isn't a great solution:
This suggestion aligns more closely with the solution we were thinking of.
So, to provide a full example, in txtar format:
WDYT? |
@btrepp I think there is already an issue (#403) that is directly related to relative import paths (including module-root-relative import paths), so I'm going to retitle this issue to be about the specific pain points that you've mentioned, and create a couple of other issues to track some specific proposals designed to address those pain points. |
This actually might be the powerhouse idea here, if the name is trivially changeable you don't hit the naming things problem. It's a tricky barrier to go 'I need to pick a name, but I am not sure of the impacts'. However hey it's easy to rename later eliminates that.
I think I had read that, but I wasn't asking for relative paths, so it was a slightly different discussion, but agree with the renaming and splitting. |
Is your feature request related to a problem? Please describe.
Taking the leap from 'hey this is nice' to scaling to a medium size problem is very unintuitive when it comes to package management. I have provided feedback in other threads, but a particular bug bear is that you need to 'domain' name your module, to cross import packages inside the same module.
Eg.
cue.mod
component.mod
While this does work, imagine the work now if I decided to brand and publish my module, so I get a namespace going. Now I have to update every cue file. It also makes the encapsulation a bit weird, 'internal' packages need to now the module name.
I have seen some other discussions about relative paths, and I think this is solvable without that, mainly as a 'special' case to the package manager.
Describe the solution you'd like
We already have
What I would like
Which at the moment gives
or something along the lines of, but this might be ambiguous for built ins.
Describe alternatives you've considered
At the moment sprinkling a fake dns name works, and is useable, but it's also adds to the 'mental stack', why do we need a label to refer to our selves, we have the 'information' for a self, so it would be nice to infer it. The more items you need to keep track of, the more chances for mistakes
There's also a possibility of having a special name 'localhost', in the imports. Which could mean 'this package', and it's guaranteed to not have someone squatting it, but is that 'very weird' from a usability perspective.
Additional context
As far as I can tell, using a '/' isn't a case currently 'taken' by the import logic, there's built-ins, which are just paths, and dns, which is other cue code. So it wouldn't cause conflicts, I think.
This would also allow people to have empty module names, if it's not intended to be shared anyway. Which makes sense, and they can change a module name later without much work.
I believe this could be described as the 'root' of the module, for any paths and documentation, so that it does help put people on the 'entrypoint' of a 'project'/module being wherever cue.mod is located.
I couldn't find a simple overview of imports though (eg different use-cases) so I may have missed something in the documentation, so this may not be possible.
This shouldn't be against the disallowing of the relative imports (it's more absolute imports), but would possibly provide an alternative for people seeking it, and I think the logic of resolving a cue module would be relatively hermetic.
Implementation wise, it would be detecting a special case '/' and adding in the 'module name' implicitly for the user. Built-ins won't start with /, and neither would a proper module name.
The text was updated successfully, but these errors were encountered: