3 ms·
There's very little difference between a DSL and an API. You already know dozens of APIs. Why not DSLs?
by silverlake 14y ago
There's very little difference between a DSL and an API. You already know dozens of APIs. Why not DSLs?
- geon 14y agoThat has been bugging a long time. Exactly what is the difference? And statements like (paraphrasing the quote in the article) > You shouldn't build an app in Forth. You should build a language to model your problem domain in forth and use it to build the app. They just doesn't make sense to me. Isn't that the very definition of how to program?
- KingMob 14y agoFor a lot of languages, I agree, because there's no way to create a DSL as part of the language itself. Think of the difference as one of direction; are you fitting the domain into the language, or extending the language to fit the domain? Most languages are either general-purpose (C, Java) or their domain is fixed upon creation (SQL, Mathematica). In a Lisp, you can use macros to accomplish things that go way beyond defining a domain-specific library / API. A typical library is restricted to the capabilities of the language, but a DSL in Lisp can extend the syntax itself. Want to alter the reader so you have a way to express normal code as remote computations? Go for it. Feel like adding new math operators to use matrices instead of scalars? Knock yourself out. Common Lisp itself did exactly this when object-oriented programming came along; using nothing but macros and closures, the Common Lisp Object System (CLOS) was built.
- gruseom 14y agoThe difference between DSL and API is the difference between language and library. What is that difference? Has it ever been successfully defined?