4 ms·
>Embedding languages in Lisp is a concept since around 1962 You misunderstood what I wrote. I was talking about the terminology PG used, not the concept. PG
by jasode 9y ago
>Embedding languages in Lisp is a concept since around 1962
You misunderstood what I wrote. I was talking about the terminology PG used, not the concept. PG couldn't time-travel to the future and write "DSL" in his 1993 essay so more readers would instantly understand what he was talking about.
> it provides the necessary extension features: which allows one to reuse a lot of the Lisp machinery
I agree. The "looks built in" is a characterization that some Lisp programmers (maybe not you) would call the ability to add "new syntax" to Lisp. It's a way of contrasting with something like C++. You can't "extend
the C++ language" with new syntax for your custom project unless you fork the GCC or Clang compiler and add new keywords to the parser. All new so-called capabilities to embed a "DSL" has to be done as "functions()" with obvious parentheses to call it. Lisp ("code is data!") doesn't have this hard boundary.
>metaprogramming means to be able to program on the language level.
I agree. There's parsing/manipulating its own AST as a data structure but "metaprogramming" also has lot of currency usage to describe programs writing programs and the usage of dynamic eval().
- lispm 9y ago> I was talking about the terminology PG used What now is called 'embedded domain specific language' was called 'embedded language' in Lisp. The name is slightly shorter, but the concept is/was the same.
- jasode 9y ago>What now is called 'embedded domain specific language' was called 'embedded language' in Lisp. Exactly! If you do "Ctrl+F" search on PG's essay, you'll see it does _not_ have the phrase "embedded language" nor "embedded domain specific language". What exactly are you nitpicking?
- lispm 9y agoThat he could have used the term 'embedded language', which was used in Lisp decades before he wrote his article. So the article is probably not about embedded DSLs. What he describes is actually extending the language to express the domain - but that does still not mean that the language is 'specific'. It's not necessarily even an embedded language.
- jasode 9y ago>What he describes is actually extending the language to express the domain - but that does still not mean that the language is 'specific'. This appears to be a subjective labeling because "extending the language" is described by some other Lisp programmers as creating a "DSL". Some examples out in the wold: >"Lisp is different, it is a shape shifting creature. It can be made to adapt to any environment [...], one can build a DSL (domain specific language) within Lisp to cater to that domain." From: https://www.quora.com/According-to-Paul-Graham-in-2002-languages-can-be-ranked-in-power-order-and-Lisp-is-the-first-on-that-ranking-Is-this-still-accurate/answer/David-Lin-211 https://www.quora.com/According-to-Paul-Graham-in-2002-langu... >"Extending the syntax the way you're talking about allows you to create domain specific languages." From: https://softwareengineering.stackexchange.com/a/164674 https://softwareengineering.stackexchange.com/a/164674 >", we can extend it in Lisp itself [...] We've just created a very small and limited language for managing to-do lists embedded in Lisp. Such languages are very specific to a particular problem domain and are often referred to as domain specific languages or DSLs." From: http://www.defmacro.org/ramblings/lisp.html http://www.defmacro.org/ramblings/lisp.html What PG is describing may not be a complete and formal DSL according to your definition but others are describing his technique today as writing a <scarequote>DSL</scarequote>.
- lispm 9y ago> "extending the language" is described by some other Lisp programmers as creating a "DSL" Lisp can be extended in many ways without creating a DSL. That's the basic error you make. Paul Graham talks about extending/changing Lisp and you assume that this must be a DSL - while it is just a larger Lisp. Typically bottom-up programming does not mean developing a DSL. Though it can be that one develops one or more DSLs during bottom-up programming. But it's not necessarily so. Remember DSL means 'Domain specific language' - a language (that means syntax/semantics/pragmatics) specific (means offering a set of operations and data structures) to a domain (which has a problem which needs to be solved). A larger Lisp is neither specific to a domain, nor a new language. To give you an example: For some engineering problem (process control of chemical plant) one needs to express fuzzy values and needs to compute with them. PG advocates to implement these fuzzy data structures and operators. One then constructs further parts using these new building blocks. This could be a bunch of classes and functions. Just an extension of the existing Lisp - it would not only work with boolean values, but also with fuzzy values. While using the fuzzy operators, one extends them until all needed operators are available. With the new set of operators large parts of the solution can be written in a shorter way. One can do such bottom-up programming in many languages and now also in many popular languages. One thing that made Lisp attractive early on for this style is the interactive development mode. One creates a new building block and one can immediately try it out - improving it and testing it again was always very fast. Thus one can extend the running program piece by piece and play around with the code in combination with domain data. Something which would not be typical in C, C++ and Java. Still, if one wants, one can do bottom-up programming in those languages too. The result is neither specific to a domain (because all the other functionality is still there), nor would be a 'language' - it's just more vocabulary in an existing language - probably not even new syntax. One could also use the extension points of the language. For example Lisp would use T and NIL as constants for boolean values. One could extend the s-expression reader to add a new syntax for fuzzy values. That would not make a new specific language, but just extend the existing language along the prepared extension points.