Comment by 4gotunameagain

Comment by 4gotunameagain 4 hours ago

4 replies

Calls a simple swap function with pointers inscrutable (the only hard to decipher character is the asterisk), and as a good counterexample provides this ?

  -module(ping).
  -export([start/0, ping/1]).

  start() ->
      register(ping, spawn(fun() -> ping(0) end)).

  ping(Count) ->
      receive
          {pong, Pong_PID} ->
              io:format("Ping received pong (~p)~n", [Count]),
              Pong_PID ! {ping, self()},
              ping(Count + 1)
      end.
I am not against functional programming, or using the tools you love, but at least make a valid argument about it ;)
cess11 4 hours ago

They didn't make such an argument. It's a biographical rumination about the authors personal development and feelings.

mrkeen 3 hours ago

Port ping.erl and pong.erl to C and we'll compare them.

  • 4gotunameagain 3 hours ago

    But I am not contrasting the two languages, I'm very aware of their respective strengths and weaknesses.

    I am just disagreeing with the fact that C is hard to parse.

    • jacquesm an hour ago

      Decades long C programmer here. C is hard to parse. The thing is, you get used to it and then it feels like it is normal, but it really isn't. Not as bad as Perl, but pretty bad. And it is easy to construct one liners that are tricky to understand, I think C is the only language that has an obfuscation contest that keeps turning up gems year after year.