-
Notifications
You must be signed in to change notification settings - Fork 28
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
Problem importing definitions that are in (scheme) but not (scheme base) #211
Comments
Ah - on looking through the test code in the repo, perhaps the issue is simply my failing to understand that when compiling with huskc, On further investigation:
It all seems rather complicated. I didn't realize at all, from reading the manual, that this was what was required in order to use extensions; but perhaps I'm just not very familiar with the Scheme way of doing things. |
Added an import of |
Many thanks! |
No problem, sorry for the trouble. |
Hi, this might be more a problem with my understanding of the documentation, than with husk. tl;dr: a bunch of definitions are included in
(scheme)
but not(scheme base)
, and this causes problems when trying to use them in libraries, or trying to import(srfi 1)
.So, the "getting started" page lists a bunch of SRFI libraries which are supported. Two (SRFI-1 and SRFI-2) are mentioned as "not being included by default", making it necessary to import them. My assumption was that the other libraries listed are included by default, and don't need to be imported, but this doesn't seem to be so. For instance,
receive
(from SRFI 8) andmake-record-type
(from SRFI 9) do sometimes need to be imported (from what I can tell). And this also seems to make SRFI 1 not always work.The following seems to be true:
When executed in the top-level repl, or using
huski -i <scriptname>
, features likereceive
don't need to be imported. e.g. the following works fine in the repl:Likewise, those features work fine when use in the main file of a program compiled with
huskc
.However, they aren't available automatically from within library files; furthermore,
(import (scheme base))
will not suffice to import them, since they aren't part of(scheme base)
; but nor are they part of any of the other standard libraries listed in the manual, so it was not at all clear to me how to import them.I eventually discovered, by looking through the library definitions, that they are part of
(scheme)
but not(scheme base)
, so when writing a library, this means one has to write (for example):It seems that although the suggested method of importing SRFI 1,
works in the repl, it won't work in a program compiled with
huskc
(and without patching the source, I can't see any way of making it work), because SRFI 1 makes use ofrequire
and doesn't have access to its definition.Perhaps the manual could explain somewhere that there are definitions which are part of
(scheme)
but not(scheme base)
, and how to import them? And perhaps the manual should also clarify that(import (srfi 1))
will only work in the repl, not in compiled programs.Alternatively, perhaps
require
and other definitions could be included inlib/scheme/base.sld
, or one of the other standard libraries. I can provide a patch forrequire
, but haven't checked to see exactly what other definitions might need including.The text was updated successfully, but these errors were encountered: