TwistingTwists
Best resource to learn DSL?
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
Hey folks, I’ve been using Elixir for over a couple of years (phx, ecto, broadway, oban).
For this kind of work you do not tend, in my e...
New
Hi, I’m Dheeraj Sudan from the UK. I’m a software developer and also run a business with my wife Meenu Hinduja. I’m interested in getting...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










Most Liked
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 ?
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).Last Post!
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: