Elixir v1.14 has been released. This release brings many improvements to Elixir’s debugging experience and data type checking.Also added a new abstraction to facilitate partitioning of processes calledPartitionSupervisoras well as optimizing compile times and error messages.

Also, Elixir v1.14 is the last version to support Erlang/OTP 23. Developers are advised to consider upgrading to Erlang/OTP 24 or Erlang/OTP 25.

dbg

Kernel.dbg/2is a new macro, somewhat similar toIO.inspect/2,Specifically fordebuggingAnd customized.

When the macro is called, it prints whatever value was passed to it, as well as the debugged code itself and its location.

The following code:


# In my_file.exs
feature = %{name: :dbg, inspiration: "Rust"}
dbg(feature)
dbg(Map.put(feature, :in_version, "1.14.0"))

will print out:


$ elixir my_file.exs
[my_file.exs:2: (file)]
feature #=> %{inspiration: "Rust", name: :dbg}

[my_file.exs:3: (file)]
Map.put(feature, :in_version, "1.14.0") #=> %{in_version: "1.14.0", inspiration: "Rust", name: :dbg}

dbg/2Can complete more tasks. It’s a macro, so Elixir code can be understood _.When developers put a series of|>When piped to it,dbg/2The value of each step of the pipeline will be printed.

The following code:


# In dbg_pipes.exs
__ENV__.file
|> String.split("/", trim: true)
|> List.last()
|> File.exists?()
|> dbg()

will print out:


$ elixir dbg_pipes.exs
[dbg_pipes.exs:5: (file)]
__ENV__.file #=> "/home/myuser/dbg_pipes.exs"
|> String.split("/", trim: true) #=> ["home", "myuser", "dbg_pipes.exs"]
|> List.last() #=> "dbg_pipes.exs"
|> File.exists?() #=> true

PartitionSupervisor

PartitionSupervisoris a new module that implements the new supervisor type.partition supervisor Designed to help deal with the situation where a single supervised process becomes the bottleneck.If the state of the process can be easily partitioned, then you can usePartitionSupervisorto oversee multiple isolated copies of the process running concurrently, each assigned its own partition.

See the release note for details.

#Elixir #v114 #released #functional #programming #language #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *