homologist
Is there any way to, at compile time overrid ALL functions foo that somebody would wrote in a module A.
I think I can do it overriding def/2. But I feel like i would be using a hammer. Any ideas?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
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
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
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
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 16 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
dom
If it’s for logging calls or computing statistics, you could use the standard tracing tools in Erlang’s dbg module.
NobbZ
Either you use the on definition callback to collect data which you apply in before compile, or you require your client to annotate each function explicitly either by listing them as argument to your useing or as in the decorator package.
There were a lot of discussions about decorators and only a handful of people actually wanted them, most said they are not necessary…
So the few that needed them created the package and still seem to maintain it.
homologist
Yes my client would have to call use.
I’m not sure if it apply to simple approach you guys suggested or just for dude who would like to insert code in a function. That’s why i didn’t dig deeper in this way
NobbZ
Your client has to be explicit somewhere about what you shall change.
Either he has to call explicitly your service per function, or he has to use moduleattributes to annotate the functions as in
:decorator-package, or he has to tell whenuseing your module.You should be able to use that information the client provided in a
@on_defintioncallback.homologist
Thanks for the package, I did find some, but not this one.
On_definition, I understand prevent(or try to) redefining the actual function.
I try to have
and under the hood it would compile like
The thing is, I’m not naming the function foo but the client of the module is. And me I’m just providing him a plugin.
NobbZ
A callback is implemented against a contract given by a behaviour, which dictates names and arities, so you now all you need…
Please check if the
:decoratorpackage suites your needs or if you can take some insights from it.Maybe you can also pull some use from the
@on_definitionmodule attribute.At the moment, I really can’t tell you anything more, since I simply do ot understand what you want to achieve… You say, you want to decorate all
foo, but then you say you do not know what you want to decorate, and then again you say thats a callback, so you have a contract… I’m confused about your plans…homologist
The log was just an example. Its just some callbacks
NobbZ
You neither know how the function will be named nor what arguments it might get? What do you actually want to log then?
NobbZ
Or better probably this
This way only the decorator is accessible and doesn’t have an obfuscated name.
homologist
I’m not supposed to write anything in the module A. So a client would go:
and under the hood it would compile like
And my main problem is that i don’t know the name and arity of foo function. So it’s acutally hard to have any simple strategy like @kokolegorille suggested.