chibi-scheme icon indicating copy to clipboard operation
chibi-scheme copied to clipboard

Chibi doesn't check single argument to `+` and `*`

Open jpellegrini opened this issue 3 years ago • 3 comments

Hello!

It looks like Chibi doesn't check single argument to + and *:

;; a is not bound:
;;
> (- 'a)
ERROR on line 2: invalid type, expected Number: a
> (/ 'a)
ERROR on line 5: invalid type, expected Number: a
> (+ 'a)
a                  ;; <== oops!
> (* 'a)
a                  ;; <== oops!

jpellegrini avatar Oct 08 '21 18:10 jpellegrini

I just opened the issue and I see that both Guile and Gauche do the same. Is this allowed by the standard? If it is, I apologize for the noise!

jpellegrini avatar Oct 08 '21 19:10 jpellegrini

In R7RS, "it is an error" but an implementation need not signal an error. While Chibi's behavior may hide programming errors, it is allowed by the standard.

mnieper avatar Oct 08 '21 19:10 mnieper

Ok I understand... But still, + is returning a wrong value as result. Anyway, I'm ok with closing the bug, no problem.

jpellegrini avatar Oct 08 '21 23:10 jpellegrini