Instead of a flat string, Erlang — oops, did I say Erlang? I meant Elixir — creates a nested list containing four leaf elements that add up to the string we expect: “Hello “, “&”, “amp;”, and " Goodbye”. At first glance this may seem like a pointless complication, but let’s see what the computer thinks about the situation.

If you look at the man page for writev, you’ll see it’s a “gathered write”, which means it writes data from multiple memory locations in a single system call. I wrote a little DTrace script to unpack the writev call we saw earlier, and peek at what that Elixir code is actually doing with this system call.

#erlang #elixir #dtrace #write #writev #syscall #string #strings #programming

բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)