Creating a fake or dummy pid in an elixir

In erlang, you can create a pid that does not match the process. An example using this can be found here in Erlang's β€œExploring You” section.

pid(0,250,0).

Is there a way to do the same in an elixir? The closure I have at the moment is to create a process that exits immediately and uses this pid.

fake_pid = Process.spawn(fn -> end)

These are seams, like a bit of a hack, and I'm not sure if there can be some slight differences between a never-created pid and a dead pid.

+4
source share
2 answers

pid/3 Erlang Elixir:

:c.pid(0,250,0)

- Erlang:

X, Y, Z pid. .

+7

self() . , .

- pid, Process.spawn/1 , , pid ( - ) ( , ).

Erlang :c.pid/3 Elixir 1.1 IEx.Helpers.pid/3 , .

+3

Source: https://habr.com/ru/post/1609255/


All Articles