Hello,
ecl does not specialize the print-object method on hash-tables:
> (find-method #'print-object '() '(hash-table t))
> Debugger received error of type: SIMPLE-ERROR
> There is no method on the generic function PRINT-OBJECT that agrees on
> qualifiers NIL and specializers (HASH-TABLE T)
After reading the hyperspec carefully, I think this is ok, it only requires
it on standard-object and structure-object. However, i still thought that
specializing on hash-table would work, but it doesn't:
>> (defmethod print-object ((obj hash-table) stream) (princ "its working"
> stream))
> #<standard-method PRINT-OBJECT (#<The BUILT-IN-CLASS HASH-TABLE> #<The
> BUILT-IN-CLASS T>)>
> >> (make-hash-table)
> #<hash-table 000000000493ee40>
Shouldn't we still dispatch the call to this method? And if not, what's the
best way in ecl to customize the printable representation of a hash-table?
I've tried:
> > (set-pprint-dispatch 'hash-table (lambda (s obj) (princ "its working"
> s)))
> NIL
> > (make-hash-table)
> its working
But this sometimes gives an error:
> Debugger received error of type: SIMPLE-ERROR
> Tried to modified a read-only pprint dispatch table:
> #<pprint-dispatch-table 0000000003375210>
> Error flushed.
Thanks!