mguimas
A module X in file /project/lib/x.ex has the following module metadata:
iex(7)> X.module_info()
[
module: X,
exports: [__info__: 1, foo: 0, module_info: 0, module_info: 1],
attributes: [vsn: [259318855844826186809719652690816251721]],
compile: [
version: '7.3.1',
options: [:dialyzer, :no_spawn_compiler_process, :from_core,
:no_auto_import],
source: '/project/lib/x.ex'
],
native: false,
md5: <<195, 22, 254, 181, 205, 81, 155, 43, 204, 133, 244, 77, 11, 5, 183,
73>>
]
How can one modify the source entry to something else than the name of the file where module X is defined?
I tried
defmodule X do
@compile {:source, "/project/lib/another_file.ex"}
def foo, do: IO.puts "foo"
end
but this has no effect.
Thanks
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
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
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
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
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
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
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
@fileif I recall correctly. But it’s meant to be used for generated files only, as well as@line.mguimas
@fileworks on a function basis, not for the whole module unfortunately.tty
The closes I know is to strip the beam.
:beam_lib.strip_files(["Elixir.X.beam"]).Honestly though I’m not sure why you would want to manipulate the source compile attribute. source and vsn are 2 quick checks in production that you are running the modules you think you should be running.
mguimas
I want to manipulate it in generated modules, not in those written by hand of course.
michalmuskala
The solution might be to use
Module.createexplicitly instead of usingdefmodule- you can alter thefilein the environment passed in there.mguimas
I thought about that but there are issues.
For example, if we do like this
then when calling
Y.foo()andY.bar()the lines in the stracktraces are the same. I think this is because quote does not add metadataline: numberin this case (only when the quotes are generated by the compiler when calling macros do they get theline: numbermetadata).I also tried to do
quote location: :keep do ...but then the file is the physical file, noty.ex.The only solution I found is to do
Macro.postwalkto add the metadatakeep: {"y.ex", number}on every node that has the metadataline: number.This solution is working well, but a more direct way would be preferable. The possibilities are:
have
@fileset the file for all following functions and macros, not only the next onesupport
quote location: "filepath" doandquote lines: true doIn fact, I think both points 1) and 2) would be useful for my and other use cases.
OvermindDL1
quotedoesn’t, but calling a macro with AST does.mguimas
Yep, that’s what I said (unless I expressed myself badly
)
OvermindDL1
Just clarifying that quoting into something is not the same as building Macro’s in Elixir (which is oddly different from other languages). ^.^;