Erlang/OTP 17.0 has been released on April 9

Erlang

Erlang — is a general-purpose concurrent, garbage-collected programming language and runtime system. Erlang Logo The release has a lot of new different features and changes. The first thing is that the versioning scheme has been changed. Previously it was R15B, R16B, etc.

New data type — Maps

This one is the most noticeable change that the community had been waiting a long time for. See an example below:

1> Map = #{ key1 => "Value1", key2 => "Value2"}.
#{key1 => "Value1",key2 => "Value2"}
2> maps:get(key1, Map).
"Value1"
#{key2 := MatchValue} = Map.
#{key1 => "Value1",key2 => "Value2"}
4> MatchValue.
"Value2"
Map2 = Map#{key3 => "Value3"}.
#{key1 => "Value1",key2 => "Value2",key3 => "Value3"}
Map3 = Map2#{key1 := change_value1}.
#{key1 => change_value1,key2 => "Value2",key3 => "Value3"}

This data type is still experimental and has a few limits:

  • Values can only be extracted via helper functions. You can not access a key by its name. This will not work: Value = Map#{key1}
  • You can not set a key which is not known during the compilation time.

Here is the whole list of features, which will be implemented later.

Erlang/OTP has been ported to the real time operating system OSE

OSE is a high-performance, POSIX compatible, multicore real-time operating system maximizing your hardware utilization

The highlights show that not all the parts of the platform have been ported though.

Anonymous functions can have names

…and can be used in recursion:

1> TestFun = fun Factorial(0) -> 1; Factorial(Num) when Num > 0 -> Num * Factorial(Num - 1) end.
#Fun
2> TestFun(4).
24
Improved Unicode support

For example, the default encoding for all the source files is now UTF-8.

And much more
  • New option {active, N} for TCP, UDP and SCTP sockets
  • Improved the mapping from ASN.1 OCTET STRING and bit strings to Erlang data-types
  • New optional scheduler utilization balancing mechanism (optional)
  • Experimental “dirty scheduler” functionality

The new release can be downloaded from here. LYSE has added new chapter about maps. Joe Armstrong’s post about the release. Changelist Official release announcement

Comments

    3,751

    Ropes — Fast Strings

    Most of us work with strings one way or another. There’s no way to avoid them — when writing code, you’re doomed to concatinate strings every day, split them into parts and access certain characters by index. We are used to the fact that strings are fixed-length arrays of characters, which leads to certain limitations when working with them. For instance, we cannot quickly concatenate two strings. To do this, we will at first need to allocate the required amount of memory, and then copy there the data from the concatenated strings.