[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

doesn't know whether compiled-function is empty

Jim Newton

1/21/2016 12:37:00 PM

It looks like both clisp and sbcl are both unable to tell whether COMPILED-FUNCTION is a subtype
of NIL or not. And consequently, SUBTYPEP returns NIL,NIL in many cases concerning COMPILED-FUNCTION.


[1]> (subtypep 'compiled-function 'array)
NIL ;
NIL
[2]> (subtypep 'array 'compiled-function)
NIL ;
T
[3]> (subtypep 'compiled-function 'array)
NIL ;
NIL
[4]>


It looks to me like SUBTYPEP doesn't know whether there exists a COMPILED-FUNCTION, therefore
it thinks it might be the empty subtype of ARRAY.

Shouldn't the type system assume that COMPILED-FUNCTION is non-nil?

The spec says: http://www.lispworks.com/documentation/HyperSpec/Body/t_...

Functions whose definitions appear lexically within a file that has been compiled with compile-file and then loaded with load are of type compiled-function.

So, my interpretation is, that any CL which has bootstrapped enough to be calling SUBTYPEP, must necessarily have at least one COMPILED-FUNCTION in memory.

Am I missing something?
Shouldn't (SUBTYPEP 'COMPILED-FUNCTION 'ARRAY) return NIL, T rather than NIL, NIL
?
4 Answers

Jim Newton

1/21/2016 12:43:00 PM

0

It does not look to me like according to the spec SUBTYPEP is allowed to return NIL,NIL in the case
(SUBTYPEP 'COMPILED-FUNCTION NIL), as none of its arguments involve and, eql, the list form of function, member, not, or, satisfies, values...

http://www.lispworks.com/documentation/HyperSpec/Body/f_...
subtypep is permitted to return the values false and false only when at least one argument involves one of these type specifiers: and, eql, the list form of function, member, not, or, satisfies, or values.

Jim Newton

1/21/2016 3:31:00 PM

0

Here is the sbcl definition of compiled-function

(sb!xc:deftype compiled-function ()
'(and function
#!+sb-fasteval (not sb!interpreter:interpreted-function)
#!+sb-eval (not sb!eval:interpreted-function)))


should;'t this instead be something like the following to avoid being vacuous.

(sb!xc:deftype compiled-function ()
'(or (eql #'eql)
(and function
#!+sb-fasteval (not sb!interpreter:interpreted-function)
#!+sb-eval (not sb!eval:interpreted-function))))

Pascal J. Bourguignon

1/21/2016 9:51:00 PM

0

Jim Newton <jimka.issy@gmail.com> writes:

> It does not look to me like according to the spec SUBTYPEP is allowed
> to return NIL,NIL in the case
> (SUBTYPEP 'COMPILED-FUNCTION NIL), as none of its arguments involve
> and, eql, the list form of function, member, not, or, satisfies,
> values...

clhs subtypep says:

subtypep never returns a second value of nil when both type-1 and
type-2 involve only the names in Figure 4-2, or names of types
defined by defstruct, define-condition, or defclass, or derived
types that expand into only those names. While type specifiers
listed in Figure 4-2 and names of defclass and defstruct can in some
cases be implemented as derived types, subtypep regards them as
primitive.


Both NIL and COMPILED-FUNCTION are in Figure 4-2, therefore those
implementations are not conforming.


--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

Jim Newton

1/22/2016 10:19:00 AM

0

Thanks Pascal, I've filed a bug report against SBCL

https://bugs.launchpad.net/sbcl/+b...