3 ms·
Whether DSL or not, Paul Graham does emphasize the use of macros, in more than one of of his essays. Not just the stock of macros that you get from an implement
by kazinator 9y ago
Whether DSL or not, Paul Graham does emphasize the use of macros, in more than one of of his essays. Not just the stock of macros that you get from an implementation, but the program's own. For instance, I read something of his some fifteen years ago where he claimed that it was typical for a Lisp program to be about 25% macros.
lispm is right that a bunch of macros don't necessarily make a domain-specific language. If I use PG's anaphoric if macro, or "with-gensyms", I'm not in a different domain; I just have some shorthand for what I'm already doing.
- jasode 9y ago>I'm not in a different domain; The "domain" doesn't have to necessarily mean different disciplines such as "game programming" is one domain and "online shopping" is another domain. Thanks to montrose's reminder, I cite PG's "On Lisp" page 5 (which appears immediately after the "Programming Bottom-Up" section): >We transform our software from a mere program into a _programming language_, and advanced users can build upon it the extra features that they need. [...] The simplest bottom-up programs consist of two layers: language and program. Complex programs may be written as a series of layers, each one acting as a programming language for the one above. If this philosophy is carried all the way up to the topmost layer, that layer becomes a programming language for the user. Also in section "1.4 Extending Lisp" page 7: >Lisp is an excellent language for writing compilers and interpreters, but it offers another way of defining a new language which is often more elegant and certainly much less work: to define the new language as a modification of Lisp. Then the parts of Lisp which can appear unchanged in the new language (e.g. arithmetic or I/O) can be used as is, and you only have to implement the parts which are different (e.g. control structure). A language implemented in this way is called an _embedded language_. Embedded languages are a natural outgrowth of bottom-up programming. Yes, the 1993 time period predates today's "DSL" meme but now that "DSL" has permeated into widespread programmers' awareness, is there a better label to describe those PG paragraphs? I argue that today, people would rewrite PGs technique in their mind as "layering DSLs".