Re: [Chicken-users] reexport - not working as expected (or I have wrong expectations)

2018-07-22 Thread Martin Schneeweis
Hi Evan,

Evan Hanson  wrote:
> That's right, in C5 there is `import' (which corresponds to C4's
> `use') and `import-syntax' (which is C4's `import').

thank you for the clarification - and thanks to kooda - if my
understanding of the differences between "import" in chicken-4 and
chicken-5 had been better your answer had helped as well.

> Martin Schneeweis  wrote:
> > 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.

Indeed - if I change the code of mod-b (chicken-5) to 

  (module mod-b ()
(import scheme chicken.base chicken.module mod-a)
(reexport (only mod-a test-a)))

(mod-a is now in the import- and the reexport-form) - then "test-a" is
callable in mod-c (mod-c only imports mod-b).

> [...] 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.

I don't think that's neccessary (I have an account) - import + reexport
works in chicken-5 - furthermore I am just working on a pet project
while learning (chicken) scheme (although the pet has grown quite a
bit). I am using chicken-4 (for the pet) and test with chicken-5 before
posting to avoid unnecessary noise (sorry for the fail this time
around).

Thanks again,
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)

2018-07-21 Thread Evan Hanson
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)

2018-07-21 Thread Martin Schneeweis
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)

2018-07-21 Thread kooda
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)

2018-07-21 Thread Martin Schneeweis
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