Types on the BEAM

Currently a hot topic in the BEAM world, let’s start a thread for it (as suggested by @crowdhailer here) :smiley:

What are your current thoughts? What would you like to see/not see? :upside_down_face:

4 Likes

I would really like to see types on the beam. Right now the one that I’m keeping the closest eye on is Hamler (https://github.com/hamler-lang/hamler). I know the other project is Gleam, but I’m indifferent to the syntax. It must be pretty hard since projects like Alpaca, and Elchemy have been abandoned.

For me it’s not about checking types, it’s really about reasoning about the code. When I put my Elixir projects down and come back 3 months later, when I navigate to the function that needs changing, it involves tracing every call site to infer what types are getting passed in. I loose interest in having to Hindley/Milner all my types when the computer can do it better than me :stuck_out_tongue: To be fair typespecs are great but it’s so easy for them to get out of sync and doesn’t help when you pass a function to another function and need to know the type signature (at runtime).

4 Likes

I am fully with you on the sentiment – but I am trying very hard to detach myself from syntax tastes. I have found so many times during my career that syntax barely matters. If the language constructs and the runtime are good I can swallow almost any syntax (well, maybe not COBOL but who knows).

4 Likes

Very true.

Personally I quite like the ML-style syntax, speak Haskell, Elm, and the like. At the same time I’m not really fond of the C++ style syntax with deeply nested :: namespaces with lots of shortened names, like std or Buf (seriously, you couldn’t call if Buffer)?

But the latter also applies to Rust and I cannot deny that Rust is a very thoughtfully designed language with a lot of merits (I’m actually learning it at the moment).

So yeah, as I see it good language design is nearly orthogonal to choice of syntax.

3 Likes

I quite like the Gleam syntax (tho if I had my way would prefer it to be more like Ruby’s :blush:)

Please add some examples of your favourite types of syntax to our syntax thread too : The syntax thread! It’s always interesting in seeing examples of syntax people like :slight_smile:

1 Like

It’s very heavily Rust-inspired. :wink:

2 Likes

It makes sense when you know that most lower-level language programmers dislike IDEs and thus don’t make heavy use of autocompletion (although f.ex. Spacemacs and, by extension, Emacs is quite good at autocomplete). And they often have to crank up quite a bit of code so merciless terseness becomes attractive.

2 Likes

I believe that is more because people love to create acronyms/abbreviations because it make them look smart, and this is not only within developers, it’s a plague in all business areas, and makes everything harder to learn then it should.

For me explicitness(full word) is always a win over implicitness(acronym) :slight_smile:

Search Google for:

  • acronyms make you smart
  • acronyms make you dumb
  • why not to use acronyms

And now you have a lot of reasons to think about :wink:

2 Likes

Likely true for many – I’ve seen people overdo it and then act in an elitist manner (like, how can you not know these specialyzed acronyms?) – but not true in my case.

To use @wolf4earth’s example, I know what Buf is or at least I intuitively assume the normal meaning. And I’ll reiterate that many people – myself included – don’t work through full-blown IDEs and thus don’t use autocomplete (although you can use it both in VIM and Emacs without a graphical environment). I never want to lose the ability to edit well if I just SSH into a remote machine so I keep my knowledge of vi and Emacs keyboard shortcuts on a decent level. But of course, all personal preferences.

1 Like

Well I don’t know from heart, and I have an hard time getting why saving typing 3 letters can improve anyone’s productivity, but I see some that only save 1 letter… really?

1 Like

Buffer -> Buf is a superficial illustratory example only. There are ton of others like Implementation -> Impl, or Dictionary -> Dict. When you don’t use auto-complete these things build up and take surprisingly big amounts of time.

But, well, I am not willing to pursue this topic forever. :slight_smile:

1 Like