home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!mimsy!waander
- From: waander@cs.umd.edu (Bill Andersen)
- Newsgroups: comp.lang.lisp
- Subject: Selective compilation of reader macro forms...
- Message-ID: <60132@mimsy.umd.edu>
- Date: 7 Sep 92 07:53:49 GMT
- Sender: news@mimsy.umd.edu
- Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
- Lines: 38
-
-
- I have a reader macro which I want to do two different things depending on
- whether the form following the macro is being compiled, or is being
- entered interactively. The best way to show this is with an example:
-
- (defun lookup (name)
- (or (gethash name *table*)
- (error "Sorry, ~s is not in *table*" name)))
-
- (defun read-thing (stream sub-char infix-arg)
- ...read name as a string from <stream>
- ...call (lookup <name>)
- )
-
- (set-dispatch-macro-character #\# #\$ 'read-thing)
-
- ==========
-
- I want to be able to compile a function referencing #$Foo
- without having to worry about an error if "Foo" is not in
- *table* during compilation. I just want a call to
- (lookup "Foo") compiled into the function. Example of
- how this should work follows:
-
- > #$Foo
- #<thing named "Foo">
-
- > (defun doit () #%Foo)
- DOIT
-
- > (doit)
- #<thing named "Foo">
-
- ==========
-
- Thanks in advance...
-
- ...bill
-