[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MCL bug?



Dear MCL members,

We have detected a bug (?) in the MCL compiler. Look at the next code:

(defun make-object ()
  (labels
    ((method1-fun () 'method1)
     (dispatch ()
       #'method1-fun))
    #'dispatch))

Please notice that the funcall returns NIL.

? (setq o1 (make-object))
#<COMPILED-LEXICAL-CLOSURE DISPATCH #x11DC76E>
? (funcall o1)
NIL

Changing the order in the labels declaration:

(defun make-object ()
  (labels
    ((dispatch ()
       #'method1-fun)
     (method1-fun () 'method1))
    #'dispatch))

It works returning the function METHOD1-FUN.

? (setq o1 (make-object))
#<COMPILED-LEXICAL-CLOSURE DISPATCH #x11DE6A6>
? (funcall o1)
#<Compiled-function METHOD1-FUN (Non-Global)  #x11DE2E6>

We have used a lot this kind of constructs and we never had any problem.
Can anybody explain us what is going on?
Thanks in advance.