yuriy-chumak / ol

Otus Lisp (Ol in short) is a purely* functional dialect of Lisp.
http://yuriy-chumak.github.io/ol/
Other
222 stars 11 forks source link

Cannot import `(scheme srfi-170)` #60

Closed bentxt closed 1 year ago

bentxt commented 1 year ago

In a gitter thread in Jan 19 2023

SRFI-170 is partially implemented. I mean file and folder functions. I'm freezing at this point because a lot of tests are required.

Unfortunately I cannot import this

./ol
(import (scheme srfi-170))
Import failed because (scheme srfi-170) could not be found.

The import works for other srfis.

yuriy-chumak commented 1 year ago

That's strange...

~/Workspace/ol.git$ sudo make uninstall
rm -rf /usr/bin/ol
rm -rf /usr/bin/olvm
rm -rf /usr/lib/libol.so
rm -rf /usr/lib/ol/repl
rm -rf /usr/lib/ol
rm -rf /usr/include/ol
rm -rf /usr/share/man/man1/ol.1.gz

~/Workspace/ol.git$ sudo make install
# install Ol executable(s) to /usr/bin:
Installing main binary...
install -d /usr/bin
install ol /usr/bin/ol
Installing ol virtual machine binary...
install -d /usr/bin
install vm /usr/bin/olvm
Installing libol.so...
install libol.so /usr/lib/libol.so
Installing headers...
install -d /usr/include/ol
install -m 644 includes/ol/vm.h /usr/include/ol/vm.h
install -m 644 includes/ol/ol.h /usr/include/ol/ol.h
# and libraries to /usr/lib/ol:
Installing basic libraries...
cd libraries && find * -type d -exec install -d "{}" "/usr/lib/ol/{}" \;
cd libraries && find * -type f -exec install -m 644 "{}" "/usr/lib/ol/{}" \;
# install Ol binary REPL to /usr/lib/ol:
Installing REPL...
install -d /usr/lib/ol
install -m 644 repl /usr/lib/ol/repl
Installing man page...
install -d /usr/share/man/man1
gzip <ol.1 >/usr/share/man/man1/ol.1.gz
Ok.

~/Workspace/ol.git$ ./ol
Welcome to Otus Lisp 2.3.9-3574-5707caf6
type ',help' to help, ',quit' to end session.
> (import (scheme srfi-170))
> ;; Library (scheme srfi-170) added
> ;; Imported (scheme srfi-170)
> 

I'll recheck with fresh new VM.

yuriy-chumak commented 1 year ago

It works under fresh new VM without any changes.

@bentxt, try to make uninstall; make install. OR ./ol --home=`pwd`/libraries in the Ol repository to test.

lassik commented 1 year ago

In Scheme we generally use (import (srfi 170)). RnRS reserves the (import (scheme <...>)) library namespace for itself. What's the rationale for diverging from this convention?

yuriy-chumak commented 1 year ago

What's the rationale

Historical reasons. I haven't seen any srfi location standard, but you'r right I think... Hmmmm.

yuriy-chumak commented 1 year ago

Which one is better? ))

lassik commented 1 year ago

It's kind of obscure, but R7RS section 5.6.1 Library Syntax says:

Libraries whose first identifier is scheme are reserved for use by this report and future versions of this report. Libraries whose first identifier is srfi are reserved for libraries implementing Scheme Requests for Implementation.

This is the (srfi 1) form that all R7RS implementations now use. (Guile was the last holdout, but (import (srfi 1)) now works in Guile 3.0.9.)

lassik commented 1 year ago
yuriy-chumak commented 1 year ago

Libraries whose first identifier is srfi are reserved for libraries implementing Scheme Requests for Implementation.

Ah, I see!

Thank you. I'll update provided Ol's srfi implementations according to R7RS.

lassik commented 1 year ago

Excellent. Thank you very much!

yuriy-chumak commented 1 year ago

(import (scheme srfi-170)) works fine. (import (srfi 170)) works fine.

Closing. Feel free to open new one if needed. image