Elixir release

1.5.0

Change breakdown

Organization at a glance

Detailed changelog

Enhancement

74 changes

Tool: Elixir Module: Access

Optimize Access.get/2

Tool: Elixir Module: Base

Optimize Base encode/decode

Tool: Elixir Module: Calendar

Implement Inspect for DateTime with Calendar.ISO

Tool: Elixir Module: Calendar

Add "ISO days" format for conversions between Calendars and Date.convert/2, Time.convert/2, NaiveDateTime.convert/2 and DateTime.convert/2 (as well as bang variants)

Tool: Elixir Module: Calendar

Add :calendar field to Time struct

Tool: Elixir Module: Calendar

Add Time.diff/3, Date.add/2, Date.diff/2, DateTime.diff/3

Tool: Elixir Module: Calendar

Add Date.range/2

Tool: Elixir Module: Calendar

Add Date.new/4, DateTime.utc_now/1, NaiveDateTime.new/8 and Time.new/5 that allow specifing calendar

Tool: Elixir Module: Enum

Add Enum.chunk_by/4 and Stream.chunk_by/4

Tool: Elixir Module: Enum

Add Enum.chunk_every/2 and Enum.chunk_every/4 with a more explicit API than Enum.chunk/2 and Enum.chunk/4

Tool: Elixir Module: Exception

Add Exception.blame/3 that adds metadata to exceptions

Tool: Elixir Module: File

Add File.read_link/1 and File.read_link!/1

Tool: Elixir Module: File

Introduce :trim_bom option for File.stream!/2

Tool: Elixir Module: Inspect

Add :printable_limit to control the limit of printable structures

Tool: Elixir Module: Integer

Add Integer.gcd/2

Tool: Elixir Module: Kernel

Add left not in right to check that the left side is not in the enumerable on the right

Tool: Elixir Module: Kernel

Use the new debug_info chunk in OTP 20. This provides a mechanism for tools to retrieve the Elixir AST from beam files

Tool: Elixir Module: Kernel

defoverridable/1 accepts a module name as argument and marks all callbacks as overridable

Tool: Elixir Module: Kernel

Allow non-quoted Unicode atoms and variables according to Unicode Annex #31 (see Unicode Syntax document)

Tool: Elixir Module: Kernel

Warn when a :__struct__ key is used when building/updating structs

Tool: Elixir Module: Kernel

Cache the AST on definitions. This speeds up the compilation time from 10% to 15% measured across different projects

Tool: Elixir Module: Kernel

Improve compiler error message on invalid patterns and guards

Tool: Elixir Module: Keyword

Add replace/3 and replace!/3 for replacing an existing key

Tool: Elixir Module: List

List.starts_with?/2

Tool: Elixir Module: Macro

Introduce Macro.generate_arguments/2

Tool: Elixir Module: Map

Optimize Map.merge/3 by choosing merging direction

Tool: Elixir Module: Map

Add replace/3 and replace!/3 for replacing an existing key

Tool: Elixir Module: Map

Raise BadMapError in Map.equal?/2 when either of the two arguments is not a map

Tool: Elixir Module: MapSet

Reduce MapSet size when serialized to approximately half

Tool: Elixir Module: Process

Add Process.cancel_timer/2

Tool: Elixir Module: Protocol

Show available implementations on Protocol.UndefinedError if the protocol has been consolidated

Tool: Elixir Module: Registry

Support ETS guard conditions in Registry.match/3

Tool: Elixir Module: Registry

Support parallel: true in Registry.dispatch/3

Tool: Elixir Module: Registry

Introduce Registry.unregister_match/4

Tool: Elixir Module: Stream

Add Stream.chunk_every/2 and Stream.chunk_every/4 with a more explicit API than Stream.chunk/2 and Stream.chunk/4

Tool: Elixir Module: String

Optimise binary pattern matching in String.split/1 and String.trim_*/1

Tool: Elixir Module: Supervisor

Add Supervisor.init/2 and Supervisor.child_spec/2

Tool: Elixir Module: Supervisor

Allow module and {module, arg} to be given to Supervisor.start_link/2 and invoke module.child_spec(arg) on each argument

Tool: Elixir Module: Task

Support :on_timeout in Task.async_stream to control how tasks are terminated

Tool: Elixir Module: Task

Add ordered: false support to Task.async_stream

Tool: ExUnit Module: ExUnit

Show code snippet from test source file in case of test errors

Tool: ExUnit Module: ExUnit

Use Exception.blame/3 when formatting test errors

Tool: ExUnit Module: ExUnit

Make assert_raise/2 fail if the underlying exception has a broken message/1 implementation

Tool: ExUnit Module: ExUnit

Add start_supervised/2 and stop_supervised/1 to ExUnit. Processes started by this function are automatically shut down when the test exits

Tool: IEx Module: IEx.Autocomplete

Support autocompletion of variable names

Tool: IEx Module: IEx.Autocomplete

Support autocompletion of functions imported using import Mod, only: [...]

Tool: IEx Module: IEx.Evaluator

Use Exception.blame/3 when showing errors in the terminal

Tool: IEx Module: IEx.Helpers

Add exports/1 IEx helper to list all exports in a module

Tool: IEx Module: IEx.Helpers

Add break!/2, break!/4, breaks/0, continue/0, open/0, remove_breaks/0, remove_breaks/1, reset_break/1, reset_break/3 and whereami/1 for code debugging

Tool: IEx Module: IEx.Helpers

No longer emit warnings for IEx commands without parentheses

Tool: IEx Module: IEx.Helpers

Add runtime_info/0 for printing runtime system information

Tool: IEx Module: IEx.Helpers

Add open/1 to open the source of a given module/function in your editor

Tool: IEx Module: IEx.Info

Implement IEx.Info protocol for calendar types

Tool: Logger Module: Logger

Add metadata: :all configuration to log all metadata

Tool: Mix Module: mix compile.elixir

Add --all-warnings option to Elixir compiler that shows all warnings from the previous compilation (instead of just of the files being compiled)

Tool: Mix Module: mix escript.build

Strip debug information from escripts by default and add option :strip_beam which defaults to true

Tool: Mix Module: mix loadpaths

Ensure --no-deps-check do not trigger SCM callbacks (such as git)

Tool: Mix Module: mix local.hex

Add --if-missing flag to local.hex mix task

Tool: Mix Module: mix profile.cprof

Add Mix.Tasks.Profile.Cprof for count-based profiling

Tool: Mix Module: mix new

New styling for generated applications

Tool: Elixir Module: Kernel

not left in right is soft-deprecated in favor of left not in right

Tool: Elixir Module: Enum

Deprecate Enum.filter_map/3 in favor of Enum.filter/2 + Enum.map/2 or for-comprehensions

Tool: Elixir Module: GenEvent

Deprecate GenEvent and provide alternatives in its docs

Tool: Elixir Module: Kernel

Using () to mean nil is deprecated

Tool: Elixir Module: Kernel

:as_char_lists value in Inspect.Opts.t/0 type, in favor of :as_charlists

Tool: Elixir Module: Kernel

:char_lists key in Inspect.Opts.t/0 type, in favor of :charlists

Tool: Elixir Module: Module

Using Erlang parse transforms via @compile {:parse_transform, _} is deprecated

Tool: Elixir Module: Stream

Deprecate Stream.filter_map/3 in favor of Stream.filter/2 + Stream.map/2

Tool: Elixir Module: String

String.ljust/3 and String.rjust/3 are deprecated in favor of String.pad_leading/3 and String.pad_trailing/3 with a binary padding

Tool: Elixir Module: String

String.strip/1 and String.strip/2 are deprecated in favor of String.trim/1 and String.trim/2

Tool: Elixir Module: String

String.lstrip/1 and String.rstrip/1 are deprecated in favor of String.trim_leading/1 and String.trim_trailing/1

Tool: Elixir Module: String

String.lstrip/2 and String.rstrip/2 are deprecated in favor of String.trim_leading/2 and String.trim_trailing/2 with a binary as second argument

Tool: Elixir Module: Typespec

char_list/0 type is deprecated in favor of charlist/0

Tool: EEx Module: EEx

Deprecate <%= in "middle" and "end" expressions, e.g.: <%= else %> and <%= end %>

Bugfix

29 changes

Tool: Elixir Module: Calendar

Ensure Calendar.ISO raises a readable error when reaching up the year 10000 restriction

Tool: Elixir Module: Calendar

Return {:error, :invalid_time} for wrong precision instead of crashing when parsing ISO dates

Tool: Elixir Module: Enumerable

Raise Protocol.UndefinedError on bad functions in Enumerable implementation

Tool: Elixir Module: File

Ensure recursive file operations raise on paths with null bytes (security issue reported by Griffin Byatt)

Tool: Elixir Module: File

Support :ram/:raw files in File.copy/2

Tool: Elixir Module: Inspect

Do not use colors when inspecting error messages

Tool: Elixir Module: Kernel

Support guards on anonymous functions of zero arity

Tool: Elixir Module: Kernel

Fix compilation of maps used as maps keys inside matches

Tool: Elixir Module: Kernel

Ensure do clause in with is tail call optimizable

Tool: Elixir Module: Module

on_definition/6 callback receives body wrapped in a keyword list, such as [do: body]. This solves a bug where it was impossible to distinguish between a bodyless clause and a function that returns nil.

Tool: Elixir Module: Path

Ensure recursive path operations raise on paths with null bytes (security issue reported by Griffin Byatt)

Tool: Elixir Module: Protocol

Do not lose source compile info on protocol consolidation

Tool: Elixir Module: Record

Properly escape quoted expressions passed to defrecord

Tool: Elixir Module: Regex

Fix inspect/2 for regexes with / terminator in them

Tool: Elixir Module: Registry

Ensure Registry.match/4 works with :_ as key

Tool: Elixir Module: Stream

Fix stream cycle over empty enumerable

Tool: Elixir Module: String

Consider Unicode non-characters valid according to the specification in String.valid?/1

Tool: Elixir Module: StringIO

Fix encoding and performance issues in StringIO.get_until

Tool: Elixir Module: System

Raise on paths with null bytes in System.cmd/2 and in System.find_executable/1 (security issue reported by Griffin Byatt)

Tool: Elixir Module: System

Raise on ill-formed environment variables (security issue reported by Griffin Byatt)

Tool: ExUnit Module: ExUnit

Properly account failed tests when setup_all fails

Tool: IEx Module: IEx

Skip autocompletion of module names that are invalid without being quoted

Tool: IEx Module: IEx

Skip autocompletion of functions with default arguments with @doc false

Tool: IEx Module: IEx

Do not start oldshell alongside IEx

Tool: Mix Module: mix compile.elixir

Store multiple sources in case of module conflicts. This solves an issue where _build would get corrupted when compiling Elixir projects with module conflicts

Tool: Mix Module: mix compile.erlang

Do not silently discard Erlang compile errors

Tool: Mix Module: mix compile.erlang

Properly track -compile module attribute when specified as a list

Tool: Mix Module: mix compile.protocols

Ensure protocol implementations do not "disappear" when switching between applications in umbrella projects by having separate consolidation paths per project

Tool: Mix Module: mix compile.protocols

Do not raise when consolidating a protocol that was converted into a module