[elephant-devel] Bug, omission, or desired behaviour?

Leslie P. Polzer sky at viridian-project.de
Fri Oct 2 07:43:10 UTC 2009


Alain Picard wrote:
>
> Hello all,
>
> I've noticed that elephant blithely ignores type declarations on slots;
> e.g. something like this:
>
> (deftype position ()
>   `(integer 1 99))
>
>
> (defclass foo-object ()
>   ((name          :type string
>                   :index t
> 		  :reader  foo-name
>                   :initarg :name)
>    (position      :type     position
>                   :accessor foo-position
>                   :initform 1))
>   (:metaclass persistent-metaclass))
>
> Elephant will happily let me store 100 in the foo-object position slot.

Yes, the implementation is responsible for checking this.

If you're using SBCL, read this:

  http://www.sbcl.org/manual/Declarations-as-Assertions.html

Notably,

  CLOS slot types form a notable exception. Types declared
  using the :type slot option in defclass are asserted if and
  only if the class was defined in safe code and the slot
  access location is in safe code as well.

Would you propose that Elephant check the type as well
when serializing slots?

  Leslie

-- 
http://www.linkedin.com/in/polzer





More information about the elephant-devel mailing list