You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
philsuero
changed the title
|import| "" vs :package/module asymmetry
|import| "" vs :package/module asymmetry on .scm extension support
Feb 18, 2020
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 thea.ss
and the other one is thea.scm
.When importing using
(import "a")
it imports the filea.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 filea.ss
. But, if there is no.ss
file, it imports thea.scm
.(import :a/a)
only fails when there is no.ss
or.scm
files.That's the asymmetry.
The text was updated successfully, but these errors were encountered: