[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: visible hash tables
From: Jon L White <edsel!jonl@labrea.stanford.edu>
[...] there a whole slew of potential (or real) data types in CLtL for
which there is no commonly accepted print syntax [...] BYTE-SPECIFIER
comes to mind, as well as RANDOM-STATE, PATHNAME, [...] and non-simple
ARRAY and ARRAY with specialized element-type [...]
Lucid, like Symbolics, already uses the #P"..." approach to pathnames
[...]
[...] hash-tables have two additional interesting properties beyond the
:type and :size -- the :rehash-size and :rehash-threshold. Hash-tables
wouldn't be fully reconstructable from the printed format unless this
information were also included.
Ok, Crazy 3:39 AM Idea: CMU-CL prints pathnames out as #.(pathname
"/usr/foo/bar"). I think this was done as a quick hack to satisfy the
requirement that pathnames print out readably, and that the writer of
that code had never seen the #P syntax. BUT: the idea of using #. in
printing could be incorporated to preserve such things as array element
type in array printing. Then, if things like Make-Hash-Table were to be
modified to take :Initial-Elements keyword args, ala Make-Array, the
problem of preserving things like Rehash-Size and Rehash-Threshold could
be easily solved in a consistent, centralized way, using the
user-visible construction functions rather than a bizzare extension to
#S, which would have many weird special cases to document and implement.
One can (if one tries) envision a super printer switch,
*Print-It-Like-It-Is*, which would cause things to print out in an ugly
but information-laden way, preserving all the things that (we think)
ought to be preserved.
Now, it would be especially neato if *Print-It-Like-It-Is* printed
things in a \portable/ way, so that a hash table (or pathname!) printed
under Lucid CL could be read by any other CL. #P is obviously not
portable. (What use would people have in wanting pathnames to be
portable? Well, just today I heard a user ask a CMU-CL implementor
about having Lucid CL on a Sun talk to CMU-CL on an RT. Among other
things, these two Lisps share the same network file system, and so
passing pathnames back and forth is a sensible thing...)
--Skef