Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

Change module/package loading to include the extension #3

Open
Summertime opened this issue Jul 10, 2018 · 5 comments
Open

Change module/package loading to include the extension #3

Summertime opened this issue Jul 10, 2018 · 5 comments

Comments

@Summertime
Copy link

(for at least project-local files)

being able to do the following

var otherfile = (import "./otherfile.ö");

would simplify package resolution, be easier to teach and learn (doesn't require understanding two distinct views of the filesystem), and would allow more complex situations to be easier to manage (pre-processing resulting in multiple "views" of the same code, in different files, as an example)

@Akuli
Copy link
Owner

Akuli commented Jul 12, 2018

If I have a lol.ö library and I want to add more files, I need to break backwards compatibility by forcing people to import "lol/somefile.ö".

@Summertime
Copy link
Author

sidebar:

I think a question to answer before that is how would importing a directory work?

x.odotdot
lol/
  |-- <somename>.odotdot
  |-- file1.odotdot
  |-- file2.odotdot
  `-- file3.odotdot

I want to import all of lol

should <somename>.odotdot be __init__.odotdot or _.odotdot or even just .odotdot

to import, "./lol", "./lol/", "./lol/<somename>.odotdot", or something else?

@Summertime
Copy link
Author

I think the backwards compatibility story can be solved by the package maintainer having a stub lol.ö that points to lol/somefile.ö

in that case its just the same as maintaining any API, keep things in the old places which wrap the new underlying code

@Akuli
Copy link
Owner

Akuli commented Jul 13, 2018

<somename>: could be probably something like exports

stub files: might be confusing, i like your point about how it doesn't differ much from other api maintaining, maybe it's a good idea after all

which import string: i had thought of (import "./lol"), where the ./ is optional because it always imports relative to current file unless the import starts with <std>

@Akuli
Copy link
Owner

Akuli commented Jul 18, 2018

1 more reason why having at the end of the import would be good:

$ grep -r shit.ö   # where is this garbage used?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants