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

|import| "" vs :package/module asymmetry on .scm extension support #441

Open
philsuero opened this issue Feb 18, 2020 · 0 comments
Open

Comments

@philsuero
Copy link

There is an asymmetry between the usage of import with "" and :package/module.

In the example, there are two files defining function a. One is the a.ss and the other one is the a.scm.

When importing using (import "a") it imports the file a.ss. If there is no .ss file, it crashes with the error *** ERROR IN ##main -- No such file or directory "/path/to/a.ss".

When importing using (import :a/a) it also imports the file a.ss. But, if there is no .ss file, it imports the a.scm.
(import :a/a) only fails when there is no .ss or .scm files.
That's the asymmetry.

$ cat a.scm
(define (a) (display "scm\n") )
(export a)

$ cat a.ss 
(define (a) (display "ss\n") )
(export a)

$ cat gerbil.pkg 
(package: a)

$ ls
a.scm		a.ss		gerbil.pkg

$ GERBIL_LOADPATH=$(pwd) gxi
Gerbil v0.16-DEV-475-g6d4f5689 on Gambit v4.9.3
> (import "a")
> (a)
ss
>,q

$ GERBIL_LOADPATH=$(pwd) gxi
Gerbil v0.16-DEV-475-g6d4f5689 on Gambit v4.9.3
> (import :a/a)
> (a)
ss
>,q

$ mv a.ss a.xyz
$ GERBIL_LOADPATH=$(pwd) gxi
Gerbil v0.16-DEV-475-g6d4f5689 on Gambit v4.9.3
> (import :a/a)
> (a)
scm
>,q

$ GERBIL_LOADPATH=$(pwd) gxi
Gerbil v0.16-DEV-475-g6d4f5689 on Gambit v4.9.3
> (import "a") 
*** ERROR IN ##main -- No such file or directory "/path/to/a.ss"
> ,q

$ mv a.scm a.sxyz
$ GERBIL_LOADPATH=$(pwd) gxi
Gerbil v0.16-DEV-475-g6d4f5689 on Gambit v4.9.3
> (import :a/a)
*** ERROR IN ##main -- Syntax Error
*** ERROR IN (console)@1.9
--- Syntax Error: Cannot find library module
... form:   :a/a
> ,q
@philsuero philsuero changed the title |import| "" vs :package/module asymmetry |import| "" vs :package/module asymmetry on .scm extension support Feb 18, 2020
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

No branches or pull requests

1 participant