Google Groups Home Help | Sign in
Message from discussion Macros (was Re: Noob Wonders: Lisp-1 vs. Lisp-2
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
tim Josling  
View profile
 More options Jan 12, 7:53 pm
Newsgroups: comp.lang.lisp
From: tim Josling <tejgcc_nos...@westnet.com.au>
Date: Sun, 13 Jan 2008 00:53:28 -0000
Local: Sat, Jan 12 2008 7:53 pm
Subject: Macros (was Re: Noob Wonders: Lisp-1 vs. Lisp-2

On Sat, 12 Jan 2008 13:48:28 -0800, Don Geddis wrote:

> Looked at it from another view, Lisp has embodied many advanced programming
> language concepts that other languages ignored for decades, and only recently
> began appreciating the value and adding.  Garbage collection, macros, symbols,
> etc.  Surely, if your argument ("popularity in other languages") were valid,
> it would apply to all those concepts also (at least until the recent past).

It's interesting that other languages have been importing many features,
but macros seems to be an exception. My impression is that macros are less
used now than 10 or 20 years ago.

There seems to be a phobia about macros. People keep reinventing them but
are very wary of calling them macros.

If you have a look at the java world, there is a large amount of code
generation going on. There is also an amazing amount of patching of object
files (.class files) as well.

C++ has templates, which have reportedly now reached the stage of being
Turing-complete. But macros are still frowned upon.

There are two explanations I have seen:

1. If you use macros, you are almost defining a new language. You have to
look at the macro definition to see what the code does.

This argument seems equally applicable to the use of any facility beyond
in-line code (eg using other classes). And most languages with macros have
the ability to expand the macro for viewing.

In any case, as Paul Graham never tires of pointing out, maybe you do want
to create a new language, a domain specific language. This may be a really
good idea.

What puzzles me is that people accept patching class files but will not
accept macros. How do you look at the source of a patched class file?

2. In the early days, people went too far with macros and the code became
unmaintainable.

This seems to be just an argument for discipline in programming projects.

Is there any other explanation? Here is Sun's explanation for no macros in
Java.

http://www.artima.com/weblogs/viewpost.jsp?thread=5246

Tim Josling


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google