fireproofsocks
I’m just discovering make_ref/0 and I’m wondering how to print them as a string… I have poked through the source code, but I don’t see any way to see inside the reference values.
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
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
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
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
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
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
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
chouzar
This worked for me:
Never used references before but it seems it can be printed just fine. Or are you looking for a certain property?
ityonemo
Don’t expect to. A reference is just a marker to a “place and time”. They’re usually otherwise empty values that are “guaranteed” to be unique. Now, sometimes they are coopted by the vm to refer to “something” but by and large they aren’t references like references in the JVM.
For example, let me send a call to another process. When the response comes back, it should somehow refer to the initial call, so that this response isn’t structurally confused for a callback for some other call (that maybe got dropped and thus orphaned). The thing that the call sends, which should be packaged with the response, so that it can be can referred back to correctly is a reference.
ityonemo
demo, you can see the return address PID and a reference packaged with the call content quite clearly:
(followed by the call failing because the called pid has stopped itself)
hauleth
fireproofsocks
hauleth
Yeah, sorry, it should be
:erlang.ref_to_list/1.fireproofsocks
I should clarify the use here: I’m working on a (mostly academic) exercise that seeks to run code in multiple modules, sometimes with different runtime values given to the same module, so I want a unique identifier for each “instance” (if you’ll forgive the OO speak). A reference seemed the most appropriate way to do this. The script may generate a lot of output which will be useful for reporting and data analysis, so a CSV or similar representation makes a lot of practical sense. So the question is simply how to represent the unique reference as a string inside of a CSV or similar file.
inspect/1is fine insideiex, but for the purposes of analysis, a simple textual representation is the only thing that wouldn’t look “weird”.Plan B would be to use a UUID.
hauleth
Remember that references are meant to be unique only within single cluster, there is no guarantee for global uniqueness of the reference, in contrast to UUID.
ityonemo
Uuids also have a slightly weak guarantee. Collisions are possible. However, you’ll probably be ok.
hauleth
Much stronger than
make_ref/0(64 bits vs 122 bits, which with birthday collision will provide 1010 difference factor in possible collisions). And generating UUID can be done also outside of the BEAM, which is clearly a win for me.