←back to thread

175 points nateb2022 | 1 comments | | HN request time: 0.214s | source
Show context
glutamate ◴[] No.41521214[source]
Love the idea, but i am having a hard time finding out what the code looks like. Where can i see the code for spawn, receive and send?

> ... a command-line utility designed to simplify the process of generating boilerplate code for your project based on the Ergo Framework

Why is there any boiler plate code at all? Why isn't hello world just a five line programme that spawns and sends hello world somewhere 5 times?

replies(3): >>41521800 #>>41522012 #>>41523043 #
whalesalad ◴[] No.41521800[source]
I was looking for the same thing. A project like this really needs an `examples/` directory with a few projects to sink your teeth into.

I've been thinking for years that if a project existed like this for Python it would take over the world. Golang is close, I guess.

replies(2): >>41521998 #>>41522357 #
nvarsj ◴[] No.41521998[source]
It's right there. https://github.com/ergo-services/examples

It looks like a close copy of Erlang APIs, albeit with the usual golang language limitations and corresponding boilerplate and some additional stuff.

Most interesting to me is it has integration with actual Erlang processes. That could fill a nice gap as Erlang lacks in some areas like media processing - so you could use this to handle those kind of CPU bound / native tasks.

  func (a *actorA) HandleMessage(from gen.PID, message any) error {
    switch message.(type) {
      case doCallLocal:
        local := gen.Atom("b")
        a.Log().Info("making request to local process %s", local)
        if result, err := a.Call(local, MyRequest{MyString: "abc"}); err == nil {
          a.Log().Info("received result from local process %s: %#v", local, result)
        } else {
          a.Log().Error("call local process failed: %s", err)
        }
        a.SendAfter(a.PID(), doCallRemote{}, time.Second)
        return nil
replies(4): >>41522124 #>>41522166 #>>41522289 #>>41524383 #
1. whalesalad ◴[] No.41522124[source]
I can't tell which syntax is worse: erlang or golang.