Re: [Chicken-users] reexport - not working as expected (or I have wrong expectations)
Hi Martin, The reason for this behaviour is that `reexport' only manages syntax, i.e. it imports and exports module identifiers but does not load libraries. This is similar to the distinction between `use' and `import' in C4. On 2018-07-21 14:31, Martin Schneeweis wrote: > Isn't "reexport" supposed to import? (in chicken-5 there is no > "use" (I think)) That's right, in C5 there is `import' (which corresponds to C4's `use') and `import-syntax' (which is C4's `import'). > chicken-4: Yes, when I add "(use mod-a)" in mod-b then I can call > "test-a" in mod-b - but calling "test-a" in mod-c still leads to the > same runtime error I believe that this will work as expected in C5. > - and if I also have to include "(use mod-a)" in mod-c (or > "(import mod-c)" in chicken-5) then the purpose of "reexport" is > defeated. No? I can see the case for making `reexport' load the implementation, and potentially adding a `reexport-syntax' form to provide the current syntax-only behaviour. I may open a feature ticket for this (or you can if you have an account on bugs.call-cc.org), but this won't be changed in C4. All the best, Evan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] reexport - not working as expected (or I have wrong expectations)
ko...@upyum.com wrote: > Martin Schneeweis wrote: > > Splitting the whole thing into 3 files does not work - I get a > > runtime exception (when executing "mod-c"): "Error: unbound > > variable: mod-a#test-a". > > The one thing that is missing from your example, is that mod-a is > never loaded, this can be acheived by adding `(use mod-a)` in mod-b’s > code. Isn't "reexport" supposed to import? (in chicken-5 there is no "use" (I think)) chicken-4: Yes, when I add "(use mod-a)" in mod-b then I can call "test-a" in mod-b - but calling "test-a" in mod-c still leads to the same runtime error - and if I also have to include "(use mod-a)" in mod-c (or "(import mod-c)" in chicken-5) then the purpose of "reexport" is defeated. No? lg Martin ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] reexport - not working as expected (or I have wrong expectations)
Martin Schneeweis wrote: > Splitting the whole thing into 3 files does not work - I get a runtime > exception (when executing "mod-c"): "Error: unbound variable: > mod-a#test-a". The one thing that is missing from your example, is that mod-a is never loaded, this can be acheived by adding `(use mod-a)` in mod-b’s code. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] reexport - not working as expected (or I have wrong expectations)
Hi, I am trying to reexport functions out of my own modules - but am failing. In my simple example I have 3 modules: - mod-a: exports a simple function - mod-b: does nothing except reexporting the simple function - mod-c: imports mod-b and calls the simple function The behaviour in chicken-4 and chicken-5 are the same - when I pack all 3 modules in the same file the whole thing works (in Chicken-4 mod-c has to "import" mod-b rather than just "use" it). Splitting the whole thing into 3 files does not work - I get a runtime exception (when executing "mod-c"): "Error: unbound variable: mod-a#test-a". Does the modules have to be eggs to be able to reexport? lg Martin The attached files are for chicken-5 (module mod-a (test-a) (import scheme chicken) (define test-a (lambda () (print "test"))) ) (module mod-b () (import scheme chicken) (reexport (only mod-a test-a))) (module mod-c () (import scheme chicken mod-b) (test-a)) compile.sh Description: application/shellscript (module mod-a ( test-a ) (import scheme chicken) (define test-a (lambda () (print "test") )) )(module mod-b ( ) (import scheme chicken) (reexport (only mod-a test-a)) )(module mod-c () (import scheme chicken mod-b) (test-a) )___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users