TwistingTwists
I want to learn DSL. Don’t know how to write one. What;s the best introductory resource?
I see some macro being used here.
Is DSL only about using Macros to help write other functions easily?
Trending in Chat/Questions
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
dimitarvp
More or less, yep. You can’t really learn DSL per se, DSLs are custom languages that you build yourself. For that you need to know Elixir macros.
I recently started the Metaprogramming Elixir book and I enjoy what I saw and tried so far, so that’s one possible resource for you.
csadewa
DSL is a concept closely associated with Domain Driven Design, the idea is to have a way to easily express things inside a particular domain. For the technical part, you could learn (like dimitarvp said) Metaprogramming Elixir / Elixir Macro. For the design part, you could learn Domain Driven Design (i would recommend
Implementing Domain Driven Designfor more easier time of reading DDD).kartheek
DSL are used in runtime and compile time. At runtime they help customising the software through scripts or rules. Systems expose ability to customise the functionality/behaviour through the DSLs. For example rules editor in a firebase - Security Rules language | Firebase Security Rules . Quite a lot of google cloud services use Common Expression Language - GitHub - cel-expr/cel-spec: Common Expression Language -- specification and binary representation · GitHub
The complete guide to (external) Domain Specific Languages - Strumenta covers a lot of things about DSLs.
Elixir has metaprogramming through macros which is compile time.Ecto has DSL for simplifying queries for accessing the data. If your use case is writing a compile time DSL - elixir metaprogramming makes it easy. Runtime DSL in elixir needs a lot of things - like interpreter, etc to be implemented.
Implementing a DSL needs grammar to be formalised as language spec.
What are you trying to achieve with DSL in your application? Is it runtime or compile time ?
crispinb
That book is generally highly recommended, but if you want something shorter to start off with there’s also Saša Jurić’s blog series starting here . I haven’t gone through it yet, but I’ve found Jurić’s other writings lucid.
TwistingTwists
Thank you such detailed reply.
My use case only involves writing some macros to help write other code easier at compile time.
kartheek
Thank you. Like @crispinb pointed out Sasa Juric’s blog post series is a good place to start.
Metaprogramming Elixir -Metaprogramming Elixir: Write Less Code, Get More Done (and Have Fun!) by Chris McCord is a book which is completely about Metaprogramming. You will find a coupon code in this forum for most of the elixir books.
One thing about metaprogramming is - it may not be needed most of the time. Using
importand functions might solve the problem. Chapter 6 of Metaprogramming Elixir book explains more about it.I learnt a lot by searching about how elixir, ecto and phoenix use defmacros in their code base: