fireproofsocks

fireproofsocks

Printing references as strings?

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.

Marked As Solved

hauleth

hauleth

Yeah, sorry, it should be :erlang.ref_to_list/1.

Also Liked

hauleth

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.

ityonemo

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.

hauleth

hauleth

make_ref()
|> :erlang.ref_to_list()
|> List.to_string()

Last Post!

dimitarvp

dimitarvp

True, I was kind of referring to the API contract. :smiley:

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement