Order of definitions in REPL

Bug #230395 reported by Joe Near
4
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Committed
High
Abdulaziz Ghuloum

Bug Description

Definitions that call functions defined later in the file don't seem to be handled as I would expect when loaded at the REPL. When run as a script, they work as I expect. For example:

jnear@sandstone r6mk $ cat test.scm
#!/usr/bin/env scheme-script
(import (rnrs))

(define foo
  (lambda ()
    (bar)))

(define bar
  (lambda ()
    (display "bar!")
    (newline)))

(foo)
jnear@sandstone r6mk $ ikarus --r6rs-script test.scm
bar!
jnear@sandstone r6mk $ ikarus test.scm
Ikarus Scheme version 0.0.3+ (revision 1477, build 2008-05-13)
Copyright (c) 2006-2008 Abdulaziz Ghuloum

Unhandled exception:
 Condition components:
   1. &assertion
   2. &who: eval
   3. &message: "unbound variable"
   4. &irritants: (bar)

Related branches

Revision history for this message
leppie (leppie) wrote :

You can always just start the REPL and call (load "test.scm") (or (include "test.scm")).

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

I noticed this yesterday and was going to report it, but you raced me to it. Thanks.

Changed in ikarus:
assignee: nobody → aghuloum
importance: Undecided → High
status: New → Confirmed
Revision history for this message
leppie (leppie) wrote :

How exactly does it work? It starts the REPL and then do a load/include on the filename(s) passed as parameters? How do you pass additional parameters/files?

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Fixed in 1478. Let me know if that messed up something else.

Changed in ikarus:
status: Confirmed → Fix Committed
Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote : Re: [Bug 230395] Re: Order of definitions in REPL

On May 15, 2008, at 6:37 AM, leppie wrote:
> How exactly does it work? It starts the REPL and then do a load/
> include
> on the filename(s) passed as parameters? How do you pass additional
> parameters/files?

When you start "ikarus file1 file2 file3 ...", the contents of the
files will be evaled one by one before the repl prompt comes up.

Revision history for this message
leppie (leppie) wrote :

Thanks :)

So it is effectively:

ikarus
> (include file1)
> (include file2)
> (include file3)
...
> ; this is where we end

?

Changed in ikarus:
milestone: none → 0.0.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.