[Ecls-list] Bug: can't print-object hash-table

Stas Boukarev stassats at gmail.com
Fri Dec 28 10:31:01 UTC 2012


Stanislav Frolov <frolosofsky at gmail.com> writes:

> It seems to print functions do not call print-object method for hash-table and 
> other standard types. I would like to see some human-readable representation 
> of hash tables.
>
> (defmethod print-object ((hash hash-table) stream)
>  (format stream "42"))
> ;compiled
>
> (print (make-hash-table))
> ;evaluated => #<hash-table 0b41ef90>
>
> Reproduced with latest ECL's version from git.
That's correct, portable programs can't define methods which only
specialize on standard classes.

(set-pprint-dispatch 'hash-table
  (lambda (stream object) (print 42 stream)))

would do.

-- 
With best regards, Stas.




More information about the ecl-devel mailing list