Subject: Re: writing out expressions prepended by #.
From: Erik Naggum <erik@naggum.net>
Date: Sat, 28 Apr 2001 02:34:52 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3197414092128104@naggum.net>

* Kent M Pitman
> The only disadvantage of #.(...) is that a lot of people bind *read-eval*
> when reading forms, and in that case you'll lose on the re-read.  To
> counteract that, you might be better off to take some other dispatch on #
> and make something similar to #S but with user-definable characteristics.
:
> I seem to recall I tried to get the committee to generalize its effect
> but for some reason it didn't go through--maybe it was after the feature
> freeze...

  I have taken to define #/ as a reader-macro akin to the format control,
  to read _registered_ types with associated functions, as I ran out of
  convenient ways to specify classes and such.

  In this particular case, #/point/(1 2 3), would require a registered type
  named point with an associated reader function that that would read as
  many arguments as it needs using whatever printer controls and reader
  functions it pleased, but it would of course be the question of more or
  less reasoanble usages, as with every other powerful mechanism.  E.g.,
  #/ip/192.168.150.155/26 could mean the address and a 26-bit mask for
  routing or matching purposes, whild #/ip/192.168.150.155:5555 could mean
  an address and a port number.  And #/md5/0123456789abcdeffedcba9876543210
  could mean the hexadecimal representation of an MD5 sum.

  Given this framework, would be a very simple task to supply macros that
  defined and registered reader functions and corresponding print-object
  methods for new classes.

#:Erik
-- 
  I found no peace in solitude.
  I found no chaos in catastrophe.
			-- :wumpscut: