What would you like to see in Erlang or the BEAM world?

surely 6

2 Likes
  • official json support
  • pipes
  • what @Gwaeron mentioned about ā€œmissingā€ functions in the lists module. Iā€™d also like to add transpose([list()]), window functions like sliding,group,group_with and probably something Iā€™m forgetting rn
  • what @lpil said about using native ca-certificates
  • I know this is out of the question but a JIT that works on rv64gc and ppc64el would be nice too : /
5 Likes

I love Erlang, coming from JVMā€™s Scala, my mind is blown away already :smiley: however I think static typing is important. It doesnā€™t need to go into too much types theory (we have Haskell for those type of programmers). However it needs to support the basic types, and perhaps some basic self defined types; so that during the compilation some errors could be shown to the user, as well as people who just start learning the language, could use these types to reason about different features of the language.

5 Likes

It evidently doesnā€™t need to support basic types or any other typing.

While the compiler doesnā€™t do what youā€™re asking for, you should have a look at the very useful static analysis tool dialyzer which is definitely up to the task!

6 Likes

Why? It is really easy to add JSON library as a dependency to the project.

3 Likes

Performance has not stopped Ruby or Python (TIOBE #1 as of Dec 2021) from mainstream popularity. And Erlang is more performant than both of those even without the JIT :thinking:

4 Likes

Per the last time this was attempted and my thoughts :

2 Likes

This is the only json module I have used the past years. I like it because it is done in Erlang without NIF. It is fast, but not sure how it stands against NIF versions.

3 Likes

Different programming languages have different application scenarios, and Erlang and Python are not used in the same scenario most of the time. Of course, speed isnā€™t just a factor in choosing a programming language. But in general, the faster the better, especially since Erlang is used for concurrent distributed programming and often handles a lot of input.

3 Likes

A few years ago, I wished for a couple of things that we already have (like a formatter, a dead-code checker, even a spellchecker, FWIW - thanks, @vkatsuba)ā€¦ But there is one thing that Iā€™ve been wishing forā€¦ for a as long as I can remember:

Better Dialyzer Warning Messages

I wish forā€¦

8 Likes

i add something
1 can add one bif fun to return the term type
2 We used term_to_string/1 string_to_term/1 a lot in previous programming. Can they be implemented in bIF?
Term_to_string /1 is usually implemented using io_lib:format, but io_lib:format large term consumes a lot of memory. I optimized the version of this function, and after optimization, the memory consumption is 1/10 of the original, It would be even better if it were implemented with a BIF.
3 Can achieve [xx | | One < - Lists] for map version, * Traversing a map efficiently and simply does not seem to be an easy task
4 I recently learned to use Redis and found it to be really simple, easy to use and efficient, how wonderful it would be if Beam integrated redis data structures into the Beam VIRTUAL machine

2 Likes

We have started to do some refactoring and cleaing up of the Dialyzer code for OTP 25. We intend to improve the messages, but it will probably not be in OTP 25.

8 Likes

I would like to be able to manipulate nested maps more easily. This would make a massive difference for data stores in ETS or gen_server states and allow my maps to be 1 to 1 mapping ā€˜hahaā€™ with the JS objects in my interfaces.

2 Likes

Iā€™m going to have a look! But if Iā€™m correct, this makes the python program act like an erlang node? In which case any python scripts will need to be sent to this node to be run.

2 Likes

Erlang containerization implementation as Docket and Kubernetes :metal:

2 Likes

This is mine. The lack of good static types is the primary source for easily 90%+ of my runtime bugsā€¦ It is the compilers responsibility to check this, not a squishy human brainmeat!

Plus refactoring or maintaining code without static types is its own layer of hellā€¦ >.>

Plus with static types the JIT could do even better by using that information. Sure it might need a callback shim on a module being loaded in the system to do the appropriate conversions if types changed in versions, but thatā€™s all doable as well and the JIT can always fallback to dynamic testing then based on the exposed types of both modules instead of needing to test the type of the data itself (removing that would be nice!). This would be a much much larger change for the language though to mandate static typing.

For an enum module it would be fairly simple to do it for any type if the type included the module callback name (like via a record type, have the first atom be the name of the module and the name of the record) or potentially just pass it in to the calls as a witness. That would be a very nice general API and a set of user-extensible iterable types!

You still can selectively receive inside a callback inside a, for example, a gen_server just fine, thatā€™s how most callback functions work (thatā€™s even how calling the public functions on a gen_server work). Just you must handle all of them eventually and allow it to return system information as well.

+1

Not in the standard library however, this is something where there an be many different styles of handling for different performance considerations and more. Adding one to the standard library is how you get the horrible things like pythonā€™s json module and so forth. Keep these as libraries, sure you can have some officially supported ones, but it still should not be in the standard library.

Eh, a positive typer like dialyzer is not a replacement for static typing, itā€™s really bad at figuring out a lot of things (that have indeed caused me bugs in the past).

3 Likes

this + near instant boot time (say, <100ms) would be really fantastic for shipping CLI utilities. I know boot time doesnā€™t matter much for servers which the VM is optimized for but, you know, one can dream!

7 Likes

doesnā€™t matter much for servers which the VM is optimized for but, you know, one can dream!

Boot-times matter in other context in the cloud. Iā€™d love to see ā€œfastā€ boot of the VM as a target of interest.

2 Likes

On my machine (which is not a very fast Linux machine) it takes about 84ms to boot and shutdown an Erlang VM.

> time ~/erlang/24.1/bin/erl -mode minimal -noinput -boot no_dot_erlang -eval "erlang:halt()"

real	0m0,084s
user	0m0,107s
sys	    0m0,016s

Booting an escript archive is about 20ms slower, so around 105ms. Unfortunately, it is a lot slower on macOS at about 200ms, which I think mostly is due to DualMapping allocation adds 100 ms to JIT startup time on Mac OS Ā· Issue #4911 Ā· erlang/otp Ā· GitHub. I didnā€™t test running the non-jit VM on macOS, but I suspect that it will be about as fast as Linux.

Of course, the more applications you start, the longer start time you get. A lot of the start time is spent doing code loading, so if we could find some way to preload/cache code loading we could probably cut that down. That is however not easily done as the loaded code today contains a lot of pointers to dynamically allocated memory (for instance literals) that would need to be handled somehow.

2 Likes

Thank you, this is good to know. On my M1 and OTP master (73737c1e3e) I see the following numbers:

with JIT:

$ time erl -mode minimal -noinput -boot no_dot_erlang -eval "erlang:halt()"
0,11s user 0,12s system 80% cpu 0,284 total

when built without JIT:

$ time erl -mode minimal -noinput -boot no_dot_erlang -eval "erlang:halt()"
0,08s user 0,12s system 129% cpu 0,156 total
2 Likes