Subject: Re: Save to file/restore from file - Lisp structures
From: Erik Naggum <erik@naggum.net>
Date: Thu, 01 Nov 2001 00:25:14 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3213563112883750@naggum.net>

* Bruce Lester
| After entries are created, the tutorial says that the state of the hash
| table can be written to a file by using print.
:
| Is this because the tutorial I am reviewing is old or that Franz did
| something differrent than the standard.

  Your tutorial is lying to you.  If you want the truth about the standard,
  consult the standard and only the standard.

  The first problem is that there is no (standard) reader macro that builds
  and returns a hash table.  And since each of the hash-tables are of type
  hash-table, not of type structure-object, #S shall _not_ be used to build
  one.  You could easily write a print-object method for hash-tables, but
  that is not quite kosher, either.  (See ANSI X3.226 11.1.2.1.2 item 19.)
  If you create your own streams class sub-type, you can get around this,
  and since you can create classes at run-time, you can conceivably write a
  class that does only hash-table printing and use it as a mixin with the
  class of the stream in a particular instance.  This gets to be a little
  bit more work than you probably expected, and is thus a typical case for
  vendor initiative, but the standard is restrictive on what a conforming
  implementation can do in this case.  I think this is unfortunate, but if
  the vendors agree on how to do this, the standard will be extended in
  letter but maintained in spirit, just as it would be if this were added
  with the appropriate standards committee blessing.

///
-- 
  Norway is now run by a priest from the fundamentalist Christian People's
  Party, the fifth largest party representing one eighth of the electorate.
-- 
  Carrying a Swiss Army pocket knife in Oslo, Norway, is a criminal offense.