From: Robert E. Brown
Subject: type declaration: ACL vs SBCL
Date: 
Message-ID: <87n0covb5q.fsf@loki.bibliotech.com>
Is the type declaration marked below with ****** legal Common Lisp:


(defmethod tree-insert (key value (tree scapegoat-tree))
  (with-accessors ((key-lessp binary-tree::key-lessp)
                   (root-node binary-tree::root-node)
                   (size size) (alpha alpha) (maximum-size maximum-size))
      tree
    (declare (type scapegoat-tree-size size maximum-size)
             (type (function (t t) boolean) key-lessp))   ; ******

    (let ((insertion-path '(nil))
          (new-node-depth 0))
      (declare (type nonnegative-fixnum new-node-depth))

        <<< rest of function deleted >>>

        )))


SBCL seems happy with the marked type declaration.  However, the trial
version of Allegro Common Lisp 6.2, macro transforms the code so that uses
of KEY-LESSP in the function body are turned into

        (the (function (t t) boolean) key-lessp)

The type checking code for this THE expression seems to be implemented using
TYPEP, since later, at run time, TYPEP generates an exception, saying it's
not required to handle type specifiers of the form "(function ....)".

                                bob
From: ·············@comcast.net
Subject: Re: type declaration: ACL vs SBCL
Date: 
Message-ID: <brt45wyt.fsf@comcast.net>
······@speakeasy.net (Robert E. Brown) writes:

> Is the type declaration marked below with ****** legal Common Lisp:
>
>
> (defmethod tree-insert (key value (tree scapegoat-tree))
>   (with-accessors ((key-lessp binary-tree::key-lessp)
>                    (root-node binary-tree::root-node)
>                    (size size) (alpha alpha) (maximum-size maximum-size))
>       tree
>     (declare (type scapegoat-tree-size size maximum-size)
>              (type (function (t t) boolean) key-lessp))   ; ******
>
>     (let ((insertion-path '(nil))
>           (new-node-depth 0))
>       (declare (type nonnegative-fixnum new-node-depth))
>
>         <<< rest of function deleted >>>
>
>         )))

Looks ok to me.

> SBCL seems happy with the marked type declaration.  However, the trial
> version of Allegro Common Lisp 6.2, macro transforms the code so that uses
> of KEY-LESSP in the function body are turned into
>
>         (the (function (t t) boolean) key-lessp)
>
> The type checking code for this THE expression seems to be implemented using
> TYPEP, since later, at run time, TYPEP generates an exception, saying it's
> not required to handle type specifiers of the form "(function ....)".

Looks like an ACL bug.