home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp
- Path: sparky!uunet!spool.mu.edu!uwm.edu!linac!uchinews!uchinews.uchicago.edu!converse
- From: converse@cs.uchicago.edu (timoshenko)
- Subject: Re: macro question
- In-Reply-To: davis@passy.ilog.fr's message of 6 Jan 93 09:27:02 GMT
- Message-ID: <CONVERSE.93Jan7001530@sloth.uchicago.edu>
- Sender: news@uchinews.uchicago.edu (News System)
- Organization: University of Chicago Computer Science
- References: <1993Jan7.040552.27087@cc.umontreal.ca>
- <CONVERSE.93Jan5225205@sloth.uchicago.edu>
- <DAVIS.93Jan6102702@passy.ilog.fr>
- Date: Thu, 7 Jan 1993 06:15:30 GMT
- Lines: 38
-
- >In article <CONVERSE.93Jan5225205@sloth.uchicago.edu>
- converse@cs.uchicago.edu (timoshenko) writes:
-
- >>I suppose you could do something like
-
- >>(defmacro a (x y)
- `(progn (defun ,x () (+ 2 2))
- (defun ,y () (* 2 3))))
- [..]
- >>Why do you want to do this, though? It's likely to be confusing,
-
- In article <DAVIS.93Jan6102702@passy.ilog.fr> davis@passy.ilog.fr (Harley Davis) writes:
- >Your solution is correct, but I don't really understand why you don't
- >like it. If all functions "should" be defined by DEFUN, then you are
- >severely limiting Lisp's potential for higher level syntactic
- >abstractions based on macros. For example, you would also have to be
- >against DEFCLASS forms which define accessor functions since these
- >function definitions aren't visible directly at the top level.
-
- Sure, you're right that DEFCLASS and DEFSTRUCT and the like
- have the useful side-effect of defining new functions, but those have
- the advantage that they are part of the language already. And, in
- fact, such side-effects _are_ confusing (though in DEFCLASS etc. the
- confusion is probably worth it). I remember a confused posting a long
- time ago from someone working through an AI programming book (AIP2?)
- who wanted to know where in the code MAKE-NODE and NODE-SLOT were
- defined. And the answer was (in a sense) "Nowhere." since they resulted
- from a defstruct. If you know the forms that have this sort of effect
- you won't be similarly confused, but you should probably have a pretty
- good reason before you use macros to create new ones. And I wondered
- whether the original poster's problem really needed to extend the
- language that far, or whether he was taking that approach because he
- was confused about something else.
-
- --Tim Converse
- --
- -------------------------------------------------------------------------------
- Tim Converse U. of Chicago CS Dept. converse@cs.uchicago.edu (312) 702-8584
-