public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Damien Mattei <damien.mattei@gmail.com>,
	kawa mailing list <kawa@sourceware.org>
Subject: Re: unbound location: *
Date: Wed, 1 Nov 2023 07:55:18 -0700	[thread overview]
Message-ID: <37e472bc-a5d0-44f2-adb2-688870134b17@bothner.com> (raw)
In-Reply-To: <CADEOadc04Yx9H8s6Mj=oMXErJPuw5R=m5e1eBE2Ya+0LT+PDbw@mail.gmail.com>

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/

      parent reply	other threads:[~2023-11-01 14:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01  8:39 Damien Mattei
2023-11-01 12:22 ` Damien Mattei
2023-11-01 12:50   ` Damien Mattei
2023-11-01 14:02     ` Damien Mattei
2023-11-01 16:11       ` Damien Mattei
2023-11-01 16:47         ` Damien Mattei
2023-11-01 16:57           ` Per Bothner
2023-11-02 21:51             ` Damien Mattei
2023-11-02 21:58               ` Per Bothner
2023-11-03 10:42                 ` Damien Mattei
2023-11-03 10:48                   ` Damien Mattei
2023-11-01 14:55   ` Per Bothner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37e472bc-a5d0-44f2-adb2-688870134b17@bothner.com \
    --to=per@bothner.com \
    --cc=damien.mattei@gmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).