seanjensengrey / mosh-scheme

Automatically exported from code.google.com/p/mosh-scheme
Other
0 stars 0 forks source link

Redefining imported variables in interactive mode #168

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open mosh REPL
2. type (define * (* 2 3))
3. type * again

What is the expected output? What do you see instead?

The expected output for step 2 is #<unspecified>
Instead I get

Unhandled exception:

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

The expected output for step 3 is 6.
Instead I get

Unhandled exception:

 Condition components:
 1. &undefined
 2. &who             who: (*)
 3. &message         message: "unbound variable"

The same thing happens if you try to redefine a variable imported from a library
in that manner.

What version of the product are you using? On what operating system?

Mosh 0.2.5 and git commit a3e9df9e510cf57e345c8a1d8321facf07670d4c on Fedora 13

Please provide any additional information below.

Traditionally in Scheme, a redefinition at the REPL has been equivalent to a 
set!.
I agree that the error is appropriate behaviour for a program ran in a batch 
mode,
however in a REPL, I'd expect to be able to rebind a variable, whether or not it
would be considered immutable in batch mode, and that it would have it's 
previous
value on it's right hand side until after the right hand side has been 
evaluated.

Mosh already lets me rebind variables I define myself i.e.
$ mosh
mosh> (define g 10)
#<unspecified>
mosh> (define g (* g g))
#<unspecified>
mosh> g
100
It allows this behaviour if I have already redefined the previously immutable 
variable.
$ mosh
mosh> (define * (lambda () #f))
#<unspecified>
mosh> (define * (*))
#<unspecified>
mosh> *
#f
mosh> (define + -)
#<unspecified>
mosh> (+ 10 7)
3
mosh> (define + (+ 10 7))
#<unspecified>
mosh> +
3

I'd also like to point out that Ikarus is in the same situation, so you're in 
good company ;)

Original issue reported on code.google.com by ianpric...@gmail.com on 29 Aug 2010 at 10:21

GoogleCodeExporter commented 9 years ago

Original comment by hige...@gmail.com on 29 Aug 2010 at 11:42

GoogleCodeExporter commented 9 years ago
Hi. Thank you for your report.

>I'd also like to point out that Ikarus is in the same situation, so you're in 
good company ;)

Acutually, we use psyntax expander which is derived from Ikarus.
So it is reasonable Mosh behaves same as Ikarus.

So we wait the answer of upstream.

Cheers.

Original comment by hige...@gmail.com on 30 Aug 2010 at 2:45

GoogleCodeExporter commented 9 years ago

Original comment by hige...@gmail.com on 31 Jan 2011 at 2:15