unbound location: *
Per Bothner
per@bothner.com
Wed Nov 1 14:55:18 GMT 2023
On 11/1/23 05:22, Damien Mattei via Kawa wrote:
> here is a counter example:
>
> ;; test-define.scm
>
> (module-name test-define)
>
> (export *)
>
> (display *) (newline)
>
> (define * +)
>
> (display *) (newline)
>
> ;; main-test-define.scm
>
> (require test-define)
>
> (define rv (* 2 3))
> (display rv) (newline)
>
> #|kawa:1|# (load
> "/Users/mattei/Dropbox/git/Scheme-PLUS-for-Kawa/main-test-define.scm")
> #<procedure +>
> #<procedure +>
> 5
>
> but i do not quite understand , first display shoud have display #<procedure *>
> but no it displays #<procedure +>
'define' is not an assignment. If there is a define in a module, that is the definition - any
other definition is not visible.
Now in some cases if you try to reference a definition before it has been given a value,
you might get an error or some kind of null/undefined value. However, it this particular
case it seems to work.
If you want the sort of dynamic definition you're expecting,
you can try define-variable.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Kawa
mailing list