GithubHelp home page GithubHelp logo

Comments (2)

nigel3289 avatar nigel3289 commented on July 25, 2024

For what it's worth, it doesn't work in CLISP in Windows when I tried it there. See further comments below Nigel
viz.
[1]> (make-instance 'standard-method :lambda-list '(foo) :function #'(lambda (foo) foo))

*** - (INITIALIZE-INSTANCE STANDARD-METHOD): Missing :SPECIALIZERS argument.
The following restarts are available:
ABORT :R1 Abort main loop

Full session:

i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ +' / I 8 8 8 8 8 8 \ -+-' / 8 8 8 ooooo 8oooo
`-|-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8

Welcome to GNU CLISP 2.48 (2009-07-28) http://clisp.cons.org/

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2009

Type :h and hit Enter for context help.

[1]> (make-instance 'standard-method :lambda-list '(foo) :function #'(lambda (foo) foo))

*** - (INITIALIZE-INSTANCE STANDARD-METHOD): Missing :SPECIALIZERS argument.
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [2]>

Regarding how SBCL is handling specializers we have

CL-USER> (setf return (make-instance 'standard-method :lambda-list '(foo) :function #'(lambda (foo) foo)))
#<STANDARD-METHOD () {1003809DD3}>
CL-USER> (describe return)
#<STANDARD-METHOD () {1003809DD3}>
[standard-object]

Slots with :INSTANCE allocation:
SOURCE = NIL
PLIST = NIL
%GENERIC-FUNCTION = NIL
QUALIFIERS = NIL
SPECIALIZERS = NIL
LAMBDA-LIST = (FOO)
%FUNCTION = #<FUNCTION (LAMBDA (FOO)) {227EBC6B}>
%DOCUMENTATION = NIL
SIMPLE-NEXT-METHOD-CALL = NIL
; No value
CL-USER>
This allowing SPECIALIZERS to be nil given the LAMBDA-LIST seems against
"The :specializers argument is a list of the specializer metaobjects for the method. An error is signaled if this value is not a proper list, or if the length of the list differs from the number of required arguments in the :lambda-list argument, or if any element of the list is not a specializer metaobject. If this value is not supplied, an error is signaled." at http://metamodular.com/CLOS-MOP/initialization-of-method-metaobjects.html
But I don't know enough about CLOS to remark further re SBCL behavior but maybe this is better:
CL-USER> (setf return (make-instance 'standard-method :function #'(lambda (foo) foo) :lambda-list '(foo)
:specializers (list (find-class 'standard-object))))
#<STANDARD-METHOD (#) {1003A03E53}>
CL-USER> (describe return)
#<STANDARD-METHOD (#) {100..
[standard-object]

Slots with :INSTANCE allocation:
SOURCE = NIL
PLIST = NIL
%GENERIC-FUNCTION = NIL
QUALIFIERS = NIL
SPECIALIZERS = (#)
LAMBDA-LIST = (FOO)
%FUNCTION = #<FUNCTION (LAMBDA (FOO)) {227EBC6B}>
%DOCUMENTATION = NIL
SIMPLE-NEXT-METHOD-CALL = NIL
; No value
CL-USER>

It makes CLISP happy viz.
[1]> (make-instance 'standard-method :function #'(lambda (foo) foo)
:lambda-list '(foo))

*** - (INITIALIZE-INSTANCE STANDARD-METHOD): Missing :SPECIALIZERS argument.
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [2]> :R1
[3]> (make-instance 'standard-method :function #'(lambda (foo) foo)
:lambda-list '(foo) :specializers (list (find-class 'standard-object)))
#<STANDARD-METHOD (#)>
[4]>
But still fails on Corman Lisp viz
(make-instance 'standard-method :lambda-list '(foo) :function #'(lambda (foo) foo) :specializers (list (find-class 'standard-object)))
;;; An error of type SIMPLE-ERROR was detected in function STD-SLOT-VALUE:
;;; Error: The slot COMMON-LISP::BODY is unbound in the object #<;;; An error of type SIMPLE-ERROR was detected in function STD-SLOT-VALUE:
;;; Error: The slot COMMON-LISP::EFFECTIVE-SLOTS is missing from the class #<Standard-Class BUILT-IN-CLASS #x614B3A0>.
;;; Entering Corman Lisp debug loop.
;;; Use :C followed by an option to exit. Type :HELP for help.
;;; Restart options:
;;; 1 Abort to top level.

But, I see on my macbook Clozure CL seems happy with nil for SPECIALIZERS and gives
? (setf return (make-instance 'standard-method :lambda-list '(foo)
:function #'(lambda (foo) foo)))
#
? (describe return)
#
Class: #
Wrapper: #<CCL::CLASS-WRAPPER STANDARD-METHOD #x302000017FAD>
Instance slots
CCL::QUALIFIERS: NIL
CCL::SPECIALIZERS: NIL
FUNCTION: #<Compiled-function # (Non-Global) #x302000D3341F>
GENERIC-FUNCTION: NIL
CCL::NAME: NIL
CCL::LAMBDA-LIST: (FOO)
?

from cormanlisp.

arbv avatar arbv commented on July 25, 2024

Thanks for reporting the problem! I might investigate it later, but it is low priority now.

from cormanlisp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.