@joshibharathiramana has joined the channel
@samth But this only works in one simple project.
For example, we can do:
in b-lib/b-lib.scm
(load "util.scm")
Then in b-lib/test.scm
(load "../a-lib/a-lib.scm")
(load "b-lib.scm")
;; ... code tests here
It works fine in b-lib/test.scm
, but my-project/main.scm
will fail. (load "../a-lib/a-lib.scm")
(load "../b-lib/b-lib.scm") ; <--- can not find `util.scm`
;; ... project entrance code here
This because load
use the working directory of the initial file rather than the relative path of the current file.
Actually, in the my-scheme-workspace
directory, there would be three projects, two test-projects and one main-project.
@soegaard2 #lang r5rs
is good, but it doesn’t support redefinition.
You need load-relative, maybe
@chansey97 Wrt redefinition: That’s external to #lang r5rs
. If you are using DrRacket you can change it in the settings: In the menu “Language” choose “Choose Language…”, then pick “Other”:
Remove the mark at “Disallow redefinition of initial bindings.”
@samth load-relative
works, but it may load the same file twice as opposed to require
. PS. pure R5RS has no load-relative
. Anyway I have given up the racket/load
approach because it is not portable.
@soegaard2 Yes, this is exactly what I am currently doing. (i.e. plt-r5rs.exe ./main.scm)
@chansey97 In that case, you need an option --no-prim
:
Yes, but I did not use this option because I don’t want to redefine primitives, i.e. +, -, … PS. If you don’t use this option, you still can redefine custom procedures.
I haven’t tested - but I think --no-prim
is equivalent to the DrRacket setting.
Yes, I think so too.
@smatuszeksa has joined the channel