1. 47
  1.  

  2. 7

    This language looks really neat. Did I read right that case statements are the only way to do control flow?

    EDIT - so I downloaded the macOS binary and installed erlang. Then I installed rebar3 and ran $ rebar3 eunit. As someone who doesn’t have any experience in the erlang world, how do I actually run the program?

    1. 8

      Unfortunately, that is a bit of a hard question to answer. Erlang officially has two ways to run software. Escripts and Releases. An escript is meant for shortlived programs (think most CLI tools) and a releases is meant to be a more “full” program.

      With that said, because gleam just generates a rebar3 project, you can just use rebar3 shell to run an interactive shell with the application loaded and running.

      1. 7

        Thank you for the kind words :)

        Yes, case expressions are the only form of flow control.

        In development you’d typically run rebar3 shell and then call the function you are interested in (in Erlang syntax). If you’re deploying to production you’d create a “release”, which a more complex process. Gleam may have some tooling that makes these tasks easier in future, but for now we’re piggy-backing off of Erlang tooling while the core language and libraries are developed.

        1. 4

          I like it! The case statement thing, I mean. Simple and effective with pattern matching.

          I was going to ask how to print hello world to the rebar3 shell, but I finally got it:

          > io:put_chars(hello_world:hello_world()).
          Hello, from hello_world!ok
          

          I didn’t realize everything was namespaced under the app name.

          Thanks for this language!

          1. 1

            No problem, thank you for trying it out!

            Once the core is more stable I’ll work on making more examples and documentation so that this is clearer.