fceruti
I need to access the application name under which a module was defined, in other words, I need the name defined in the module’s parent mix.exs.
def __on_definition__(env, _kind, func_name, args, _guards, _body) do
app_name = Application.get_application(env.module)
Application.get_application/1 doesn’t always work, as the application may or may not be available when recompiling.
Is there a non-hacky way of getting this info? I’m tempted to look at the file directory looking for a mix.exs and parsing it.
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
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
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
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
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
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
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
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
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
sodapopcan
I don’t have an answer, but I’d like to double-down on your question about looking at files during compilation as I am currently tempted to do the same. Is this a truly terrible idea? And if so, it is wrong because it’s too hacky/surprising/confusing, or is it wrong because there are gotchas?
cmo
You could put it in a file called APPLICATION and read that into the mix file as the application name and wherever else. This is sometimes done for defining the version. Could be considered hacky tho
fceruti
Yup, I’m gonna just do this, and change it later if a better solution arises.
The problem is that this is library code, that is supposed to look into your project, but also, other libraries, so it’s a no-no, to need to adhere to that standard.
For now goes like this:
josevalim
Mix.Project.config(), but only invoke it at compile time, as Mix isn’t available inside releases. Or ask the user to pass it as parameter (as Phoenix/Ecto do).
jarlah
I just have to ask, but wouldnt this enable most macros to avoid requiring the app option? Is it «safe» to fallback to the app property defined in mix config inside a library macro? Which obviously messes with our heads because its hard to understand without knowing how it works, why it works.. its a «compile runtime» call actually. In the application using the macro.?
LostKobrakai
No. Because those macros are not necessarily used just by the top level mix application (if there even is one).
fceruti
So there was a waaaay less hacky way of doing it
Thanks!