joshibharathiramana
2020-9-23 07:05:31

@joshibharathiramana has joined the channel


chansey97
2020-9-23 10:20:48

@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.


chansey97
2020-9-23 10:41:01

@soegaard2 #lang r5rs is good, but it doesn’t support redefinition.


samth
2020-9-23 13:16:02

You need load-relative, maybe


soegaard2
2020-9-23 13:19:28

@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.”


chansey97
2020-9-23 13:49:48

@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.


chansey97
2020-9-23 13:52:33

@soegaard2 Yes, this is exactly what I am currently doing. (i.e. plt-r5rs.exe ./main.scm)


soegaard2
2020-9-23 13:53:43

@chansey97 In that case, you need an option --no-prim:


chansey97
2020-9-23 13:55:10

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.


soegaard2
2020-9-23 13:56:57

I haven’t tested - but I think --no-prim is equivalent to the DrRacket setting.


chansey97
2020-9-23 13:57:19

Yes, I think so too.


smatuszeksa
2020-9-23 17:18:54

@smatuszeksa has joined the channel