compiler ignores without warning
Created by: reiniervandijk
This is based on an actual case. Compiler should have signalled problem, I'd reckon.
(define-object ignores-do (base-object)
:input-slots
((foo 2))
:computed-slots
((do ((i 1 (+ i 1))
(j 2 (+ j 1))
)
(> i 3 j)
(+ 2 2))))
However, compilation signals no errors or warnings and one could go ahead and then try:
> (make-self 'ignores-do)
#<ignores-do @ #x27b52732>
> (the do)
No methods applicable for generic function
#<standard-generic-function gdl-acc::do> with args
(#<ignores-do @ #x27b52732>) of classes (ignores-do)
[Condition of type program-error]
Obviously, do slot was somehow ignored, but compiler never told so. Isn't that faulty behaviour?
Imported comments:
By genworks on 2013-06-14 16:48:53 UTC
Indeed the compiler quietly ignores any slots which have extra "junk" after the expression other than recognized keywords such as :settable.
Constructs like this for sure should be throwing compiler errors. Issue remains open until this error-check has been added to the compiler.
Note that the problem has nothing to do with the particular symbol "do" being used -- "do" can be used as a Gendl slot name with no problem, as long as the syntax is correct. The problem here is that there are extra expressions after the apparent expression ((i 1 (+ i 1))) (which itself should have given a compiler error "Function position must contain a symbol or lambda expression," if the expression had actually made it through to the compiler).
By reiniervandijk on 2013-06-14 17:06:00 UTC
I know about the last part. Fact is, I just copied as-is from an actual case at hand (from a student doing KBE course), didn't want to invest too much time in cleaning up just for the sake of a quick example to make my point.
By genworks on 2015-01-30 00:23:01 UTC
merged with #145 (closed).