Scott McKay (swm@com.harlequin) wrote:
> Date: Tue, 18 Jul 1995 01:17:27 -0400
> From: s398960@aix1.uottawa.ca (Patricia Wilson)
> How does one disguish between clutter and a good language design
> proposal? The question applies both to very minor modifications, and
> major ones too.
>
> "Clutter" is stuff that gets added to the language which could have
> been trivially expressed in the language via a very simple macro or a
> very simple function. It's stuff that adds another way to do the same
> thing. Pop-11 is admittedly a cool language -- I've used it, and
> enjoyed using it -- but I don't think that presenting it as a paradigm
> of good modern language design holds much water.
>
> So I stand by my claim. Your proposal just adds stuff of the language
> without enriching it. Your version of 'unless' is exactly 'if ~'; In
> fact, I proposed flushing Dylan's existing version of 'unless' for the
> same reason. Write a macro.
But what is the difference between a macro that everybody uses and a
genuine part of the language?
This is a slightly philosophical question, but imagine the following
scenario: Somebody uses the following macros in their programs
#define unless if ~
#define elseunless elseif ~
[or whatever the syntax is in Dylan. I haven't the faintest idea]
and several other people see this as a really good symmetry in the
language and include it in their programs, and so on. The macros spread
until they get placed in a standard utility header file that everybody
uses by default. The macros may even become documented and written into
textbooks.
You now have a language construct that _looks_ like it's a first class
citizen but is really just a yucky hack. When the compiler throws up
syntax error messages it will think it's just compiled a "if ~ ..." (as
the pre-processor will have stripped out the "unless"). The error message
will mention the "if ~ ...", to provide "helpful" context to the
programmer, but the programmer is likely to get very lost as their program
contains "unless" (and the macro has become so pervasive that no-one
remembers it's a macro).
It's for this last reason that "good" language constructs should be built
into the explicit syntax of the language, even if they can be implemented
using macros.
Cheers,
Ian.
--
<a href=http://www.cogs.susx.ac.uk/users/ianr/>Ian Rogers</a>
|