mmport80
Obviously I am playing devil’s advocate a litte - but -
I see incredible power when using abstract code. One can do a lot in a little space, pick out bugs easily, etc.
Sure, explicitness is good when you are learning.
But when you want write something reliable and maintainable you probably should be reaching for a suitable abstraction and that means explicitness is kryptonite in such cases.
What do you think?
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Quite interesting article Google brought me. Didn’t find any mentions about it here.
What do you think in general? Would you use togethe...
New
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes.
We’re a small ...
New
Other Trending Topics
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
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
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
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 18 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
mmport80
good pt!
mmport80
Thanks for this. Appreciate it. You are right.
If I think about macros like mini compilers, and ways to create new semantics not readily available in Elixir.
They end up being a little like oil and water when it comes to composition and polymorphism etc.
axelson
Additionally if you create a library whose only interface is a macro then it is not usable by other BEAM languages such as Erlang.
michalmuskala
I would say that in general, macros belong to libraries. There are very few cases where I would consider defining a macro in an application.
For libraries my rule of thumb is to first define an interface of only functions and data structures and then evaluate if it needs macros to make it less verbose or nicer to use. The important bit is that macros shouldn’t be the first thing you start with. This leads to a much more flexible design.
mmport80
Yep, i agree that functional is a big jump already.
But don’t you lose a little from having /such/ an explicit macro?
If I have the some basic atoms which I compose and recompose together, I can reuse and compose to my heart’s content.
that’s why I am sort of suspicious of macros, they are not so much an abstraction, but a concretisation which I cannot really reuse easily..
Nice crystalisation actually, maybe that’s why I don’t like macros - because they often are not easily reuseable abstractions…
mmport80
Yup, me too, I suppose non-macro Elixir is v explicit, perhaps that’s why many people here picked me up wrong, the ABCs of abstraction are built from composition, parametric and adhoc polymorphism…
mmport80
Ecto is clearly in the Query builder / DSL region.
Thanks for the thoughtful reply, really appreciate it : )
mmport80
My point is, explicitness is a crutch sometimes, when really we want:
Explicitness /and/ DRY (i.e. a suitable abstraction)…
The good thing is, non-macro code comes is very easily explicit.
On a tangent, I would love somebody to point me to a good resource on how to use macros properly, I really need to get comfortable with that type of abstraction.
mmport80
Good pt. tbh. the macro abstraction balancing act is still something I have to fully get comfortable with. Perhaps because there is a lot left implicit!! I respect macros, but am constantly slightly worried about them : )
A simple example for “picking bugs out easily”, would be:
I.e. classic parametric polymorphism. Bugs in my DB retrieval code are capture in one place…
Another example:
x) something which uses an interface and adhoc polymorphism, a result type or error type etc.
Bugs in my result / error code are again captured in one place, rather than scattered.
You get the idea. Basically it’s DRY.
mmport80
Yes 100% true. I was cheekily conflating “implicit” and “abstract”.
I suppose the question is, when someone says, this is well written because it is “explicit”, it can still be explicit and overly verbose, not DRY etc…