[Openmcl-devel] CLOS implementation weirdness?
Dirk Eßer
essdir at web.de
Tue Jun 9 08:17:15 PDT 2015
The problem seems to be, that CCL defines a class LOCK already, which is
accessible in package CL-USER (the current package right after starting
the lisp). Due to this, you are not defining a new class, but trying to
redefine the existing class (which fails).
To start with a clean package (i.e., only symbols, which the CLHS
mandates), try
? (defpackage "FOO" (:use "COMMON-LISP"))
#<Package "FOO">
? (in-package "FOO")
#<Package "FOO">
? (defclass lock ()
((name :initarg :name :reader lock-name))
(:documentation "The foundation of all locks."))
#<STANDARD-CLASS LOCK>
Cheers,
Dirk
Am 09.06.2015 um 17:10 schrieb Adam Jensen:
> Hi, I've recently started working through [Object-Oriented Programming in COMMON LISP: A Programmer's Guide to CLOS](http://www.amazon.com/Object-Oriented-Programming-COMMON-LISP-Programmers/dp/0201175894). The example code in chapter three yields some weird results.
>
> (defclass lock ()
> ((name :initarg :name :reader lock-name))
> (:documentation "The foundation of all locks."))
>
> CLISP and SBCL seem to be okay with this code snippet but CCL gives:
>
> Error: Class option :DOCUMENTATION is not one of (:NAME)
>
>
> Example:
> -----------------------------------------------------------------
> hanzer at helix:~$ clisp
> 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.49 (2010-07-07) <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-2010
>
> Type :h and hit Enter for context help.
>
> [1]> (defclass lock ()
> ((name :initarg :name :reader lock-name))
> (:documentation "The foundation of all locks."))
> #<STANDARD-CLASS LOCK>
> [2]> (quit)
> Bye.
> hanzer at helix:~$ sbcl
> This is SBCL 1.2.11, an implementation of ANSI Common Lisp.
> More information about SBCL is available at <http://www.sbcl.org/>.
>
> SBCL is free software, provided as is, with absolutely no warranty.
> It is mostly in the public domain; some portions are provided under
> BSD-style licenses. See the CREDITS and COPYING files in the
> distribution for more information.
> * (defclass lock ()
> ((name :initarg :name :reader lock-name))
> (:documentation "The foundation of all locks."))
>
> #<STANDARD-CLASS LOCK>
> * (quit)
> hanzer at helix:~$ ccl
> Welcome to Clozure Common Lisp Version 1.11-dev-r16390M-trunk (LinuxX8632)!
>
> CCL is developed and maintained by Clozure Associates. For more information
> about CCL visit http://ccl.clozure.com. To enquire about Clozure's Common Lisp
> consulting services e-mail info at clozure.com or visit http://www.clozure.com.
>
> ? (defclass lock ()
> ((name :initarg :name :reader lock-name))
> (:documentation "The foundation of all locks."))
>> Error: Class option :DOCUMENTATION is not one of (:NAME)
>> While executing: DEFCLASS, in process listener(1).
>> Type :POP to abort, :R for a list of available restarts.
>> Type :? for other options.
> 1 > (quit)
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> https://lists.clozure.com/mailman/listinfo/openmcl-devel
More information about the Openmcl-devel
mailing list