Releases: elixir-lang/elixir
Releases · elixir-lang/elixir
v1.1.0
Official announcement: https://elixir-lang.org/blog/2015/09/28/elixir-v1-1-0-released/
1. Enhancements
Elixir
- [Application] Add
Application.fetch_env!/2,Application.loaded_applications/0andApplication.started_applications/0 - [CLI] Add support for
--werlin Windows bash-like shells - [Dict] Add
Dict.get_and_update/3which behaves similar to the now deprecated Access protocol - [Dict] Add
Dict.get_lazy/3,Dict.pop_lazy/3andDict.put_new_lazy/3 - [Enum] Add
Enum.random/1,Enum.take_random/2,Enum.min_max/1,Enum.min_max_by/2,Enum.reverse_slice/3,Enum.reduce_while/3,Enum.dedup/1andEnum.dedup_by/2 - [Enum] Inline common map usage in
Enumfunctions for performance - [File] Add
File.lstat/1andFile.lstat/1that works likeFile.stat/1but is able to return symlink information (i.e. it does not traverse symlinks) - [File] Add
File.rename/2 - [Integer] Add
Integer.digits/2andInteger.undigits/2 - [Inspect] Add the
:safeoption toinspect/2and make it safe by default, meaning failures while inspecting won't trigger other failures. Instead, it will be wrapped in an exception which is properly formatted - [IO] Support fenced code blocks on
IO.ANSI.Docs - [GenServer] Add
GenServer.whereis/1that expandsGenServerdispatches into a proper pid - [Kernel] No longer include
:cryptoand:syntax_toolsas dependencies. The former is only needed if you have encrypted debug info (therefore you can add:cryptoas a dependency manually) and the latter is no longer used - [Kernel] Raise when
var.Aliassyntax is used and it does not expand to an atom at compile time (previously it emitted warnings) - [Kernel] Improve generation of argument names for function signatures
- [Kernel]
::/2is now a special form - [Kernel] Warn when a variable with underscore is used
- [Kernel] Allow underscores in binary, octal and hex literals
- [Kernel] Warn when module attributes, variables, strings and numbers are used in code but the expression has no effect
- [Kernel] Support
\uXXXXand\u{X*}in strings and char lists to map to Unicode codepoints - [List] Add
List.keytake/3 - [Module] Improve name inference for function signatures in documentation metadata
- [Process] Add
Process.hibernate/3 - [Process] Allow a list of specs in
Process.info/2 - [Set] Introduce
MapSetdata type. This new data type uses maps behind the scenes and is useful for storing a dozens of items in Erlang 17. In future versions when maps efficiently support large collections, it is meant to be the main Set abstraction in Elixir - [Stream] Add
Stream.dedup/1,Stream.dedup_by/2andStream.transform/4 - [String] Support calculation of the jaro distance between strings (usually names) via
String.jaro_distance/2. This is used by Mix to support "Did you mean?" feature when a task does not exist - [String] Add
String.splitter/3that splits strings as a stream - [StringIO]
StringIO.flush/1was added to flush the output of a StringIO device - [Task] Introduce
Task.yield/2andTask.shutdown/2to check if a task is still executing and shutdown otherwise - [Tuple] Add
Tuple.append/2 - [URI] Default ports were added for "ws" and "wss" schemas
- [URI] Add
URI.to_string/1
EEx
- [EEx] Add
:trimoption to EEx that automatically trims the left side of<%and right side%>if only spaces and new lines preceed/follow them
ExUnit
- [ExUnit] Add number of skipped tests to
ExUnitoutput - [ExUnit] Make timeout configurable for the whole test suite via the
:timeoutconfiguration - [ExUnit] Allow moduledoc to be filtered/skipped in doctests
- [ExUnit] Provide built-in log capturing functionality
- [ExUnit] Allow
assert_receive_timeoutandrefute_receive_timeoutto be configured in the ExUnit application - [ExUnit] Allow tests to be skipped with
@tag :skipor@tag skip: "reason" - [ExUnit] Add tests without implementation (missing the do block) which automatically fail. Such tests are also automatically tagged as
:not_implemented, allowing them to be skipped - [ExUnit] Increase by default stacktrace depth to 20 (this value is also configurable)
- [ExUnit] Improve formatting on
assert_raiseerrors for message mismatch - [ExUnit] Improve formatting on
assert_receivewhen using pinned variables
IEx
- [IEx] Support
IEx.prywith--remshfor remote debugging - [IEx] Add
b/1helper that shows documentation for behaviour modules and its callback functions - [IEx] Provide tab completion for aliases and allow aliases like
Foo.Bar.Bazto autocomplete even ifFoo.Baris not defined - [IEx] Provide a
pid/3helper for buildings pids from numbers
Logger
- [Logger] Support printing pids and refs in Logger metadata
- [Logger] Allow Logger metadata to be removed from pdict by setting it to
nil - [Logger] Add application configuration
translator_inspect_optsfor logger to customize how state and message are formatted when translating OTP errors and reports - [Logger] Automatically include the current application in metadata when compiled via Mix
Mix
- [Mix] Check Elixir version right after archive installation and provide feedback if there is a mismatch
- [Mix] Allow rebar dependencies with
mix.exsto be compiled with Mix - [Mix] Allow rebar dependencies to be specified via
:path - [Mix] Also consider subdirectories in
configdirectory forMix.Project.config_files/0 - [Mix] Allow dynamic configuration in Mix projects by storing config in an agent
- [Mix] Support rebar3 style Git refs in
rebar.configfiles - [Mix] Only recompile compile time dependencies in mix projects. This should considerably speed up recompilation times in Elixir projects
- [Mix] Warn when configuring an application that is not available
- [Mix] Add
mix profile.fproffor easy code profiling - [Mix] Abort when dependencies have conflicting
:onlydefinitions - [Mix] Fully recompile projects if Elixir or SCM changes
- [Mix] Allow checksum to be checked on archive install via
--sha512option - [Mix] Add
mix local.public_keysto safely manage installation of Hex and Rebar dependencies
2. Bug fixes
Elixir
- [CLI] Ensure Logger messages are flushed when executing commands
- [Code]
:delegate_locals_tofailed to delegate to the chosen module in many situations and messed up stacktraces. This option has therefore been replaced by imports - [Code] Store the documentation line in the metadata returned by
Code.get_docs/2 - [Exception] Do not fail when calculating an exception message, even if the message is invalid
- [File] Ensure
File.touch/2andFile.stat/2receive and return universal times. Previously they would work with local times which are not monotonically increasing, which could present issues on scripts. If the times are being shown to the user,time: :localcan be given as argument - [Float] Support complete scientific notation in
Float.parse/1 - [Kernel] Do not expand
in/2argument in module body - [Kernel] Throw syntax error for undefind atom/alias syntax
:foo.Bar - [Kernel] Improve error message when we can't compile because the target directory is not writeable
- [Kernel] Allow capture of non-symbolic operators like
&and/2,¬/1and others - [Kernel] Raise if heredoc terminal is accidentally found in the middle of a line without escaping
- [Kernel] Don't warn on missing imports if nothing was imported
- [Kernel] Raise if arity bigger than 255 is given to capture operator
- [Macro] Properly convert captures in
Macro.to_string/1 - [Module] Do not accept non-Elixir module names in
Module.split/1 - [Protocol] Guarantee that derived protocols go through
Anyinstead ofMap - [Range] Restrict ranges to integers to fix diverse bugs of values being included in the range when they should not (false positives)
- [Regex] Fix splitting of empty strings with regexes when trim is set to
true. Now bothString.split/3andRegex.split/3return an empty list when called with an empty string and trim is enabled - [Regex] Fix
Regex.replace/4so it doesn't discard escape characters - [Stream] Ensure suspending
Stream.flat_map/2andStream.transform/3does not consume unecessary items from the given enumerable
EEx
- [EEx] Allow EEx interpolation to also apply inside quotations
<%%= ... %>
ExUnit
- [ExUnit] Skipped tests now correctly count towards the total of tests in the result returned by
ExUnit.run/0 - [ExUnit] Fix a bug where failures when inspecting data structure or retrieving error messages could bring the whole ExUnit runner down
- [ExUnit] Do not change the semantics of evaluated code with
assert/refute. For example, from now on,assert nil = some_expr()will now raise as expected, as the expression still evaluates to a falsy value - [ExUnit] Report proper line number for doctest failures
Logger
- [Logger] Include metadata in
Logger.log/3, useLogger.bare_log/3for runtime-only, with no metadata behaviour
Mix
- [Mix] Use the safer
httpsprotocol instead ofgitfor:githubdependencies - [Mix] Ensure automatic protocol consolidation via
:consolidate_protocolsis triggered in umbrella apps - [Mix] Do not raise if wildcard given to
import_configdoes not match any file - [Mix] Applications with
:build_embeddedset to true require explicit compilation step - [Mix] Also remove consolidated protocols on
mix clean - [Mix] Ensure
--excludeinmix testconcatenates with test helper excludes
3. Soft deprecations (no warnings emitted)
Elixir
- [Behaviour] The module
Behaviouris deprecated. Instead ofdefcallback, one can simply use@callback. Instead ofdefmacrocallback, one can simply use@macrocallback - [Enum]
Enum.uniq/2is deprecated in favor ofEnum.uniq_by/2 - [Kernel]
\xinside strings and cha...
v1.0.5
Enhancements
- [Elixir] Support Erlang 18.0
- [IEx] Rely only on loaded applications for autocompletion on IEx
- [Record] Expand attributes and macros in record extractor
- [String] Optimize
String.rstrip/1 - [String] Optimize
String.downcase/1 - [String] Optimize
String.upcase/1
Bug fixes
- [EEx] Ensure blocks do not clobber EEx buffers
- [Enum] Ensure
Enum.take/2does not consume one extra item when halting on the last emittable item - [ExUnit] Fix
StringIOprocesses leakage in theExUnit.CaptureIOwhen there are errors inside thecapture_ioblock - [Float] Avoid rounding errors on
Float.parse/1 - [GenEvent] Fix
GenEventdetection of modules that aren't loaded - [IO] Read 4K blocks instead of lines in
IO.binread/2. This fixes a bug where CRLF were being ignored and is also going to improve performance - [Logger] Handle
:undefinedarity inLogger.Translator(we get :undefined when a temporary worker of asimple_one_for_onesupervisor crashes) - [Mix] Ensure config is escaped before being injected into escripts. This fixes a bug where escripts failed to build when containing values like maps in config files
- [Mix] Ensure we properly underscore acronyms followed by paths, for example,
HTTP.Foo - [Stream] Ensure
Stream.flat_map/2does not consume more items than necessary when piped to anotherStream.flat_map/2that halts in the inner stream - [Version] Fix
to_stringfor versions with numeric pre releases
v1.0.4
Enhancements
- [Elixir] Support Erlang 17.5 and 18.0
- [Mix] Support "--search PATTERN" in "mix help"
- [Mix] Support
:start_permanentthat starts the application as permanent - [Mix] Support
:build_embeddedthat compile protocols, avoid symlinks and ensure protocols are loaded on boot - [Mix] Make "mix app.start" public and support "--permanent" and "--temporary" options
- [URI] Speed decoding operations
Bug fixes
- [Elixir] Produce clearer error messages for syntax errors before a sigil
- [Elixir] Return value when matching on
_in the last line of a block - [Elixir] Ensure changes in child deps forces the parent to recompile
- [Kernel] Fix a bug where
=~/2returned false when matching on an empty string. The current behaviour was changed to match the behaviour ofString.contains?/2 - [Mix] Store relative paths in erlang manifests
- [Mix] Fix httpc proxy option profile for downloading hex and other safe packges
- [Mix] Fix missing behaviour warning when compiling Erlang modules
v1.0.3
Enhancements
- [Elixir] Do not show exported vars warning
- [Elixir] Improve error messages when using invalid expressions inside maps
- [Elixir] Skip aliases and import warnings when code cannot compile
- [IEx] Improve autocompletion for Erlang/Elixir based on loaded applications
- [IO] Make
IO.ANSI.Docsreadable on white background - [Mix] Provide clearer error message when updating archives on Windows
- [Mix] Don't go through hex.pm API server to install Hex
Bug fixes
- [Elixir] Ensure all Elixir applications work with code upgrades
- [Elixir] Don't leave spurious processes and stale data when the parallel compiler fails
- [Inspect] Keep original stacktrace on Inspect errors
- [IO] Fix
IO.ANSI.Docshandling of*,**,_where they would be activated in the middle of words - [Logger] Fix logging with
metadata[:function] - [Mix] Don't show hex update message on mix
local.hex - [Mix] Ensure tasks are properly underscored and camelized
- [Mix] Ensure Mix does not use ANSI escapes on Windows unless ANSI is enabled
- [Mix] Only shutdown Logger if the Mix application is being actually started
- [Mix] Ensure priv/include are copied on Windows even if source did not change
- [Mix] Ensure rebar dependencies work when user path has a space on Windows
- [Regex] Fix
Regex.replace/4failures when the number of substitutions in pattern is more than the number of matches and support\g{...}patterns - [String] Fix LFCR being treated as a grapheme instead of CRLF
- [URI] Do more strict matching on URI schema
v1.0.2
Bug fixes
- [EEx] Remove invalid warning when attempting to inline code in EEx
- [EEx] Unify syntax errors to always include file:line:
- [IEx] Set null prompt function in dumb term mode
- [Kernel] Do not define an ets table with the same name as the module as it clashes with user code
- [Kernel] Fail compiling try expressions if they lack one of catch/after/rescue/else clauses
- [Kernel] Improve error messages when parsing fails on aliases
- [Kernel] Improve warnings coming from compile-time evaluation of arguments
- [String] Fix String.replace/4 typespec
v1.0.1
Enhancements
- [Mix] Add MIX_ENV output to archive.build (as on escript.build)
Bug fixes
- [CLI] Fix Elixir CLI when running on Cygwin
- [ExUnit] Include stacktraces in ExUnit timeouts
- [Mix] Load dependencies before
deps.checkcompiles dependencies - [Mix] Ensure
Mix.Configis deep merged - [Mix] Change version requirement in new apps to
~> MAJOR.MINOR - [Mix] Report correct location if
local.hexfails and give higher priority to powershell install on Windows - [Mix] Ensure
--elixirc-pathsoption forcompile.elixiris a subset of the project:elixirc_pathsconfiguration and it does not remove skipped entries from the manifest - [Mix] Ensure
compile.elixirwrites to manifest when files are removed - [Mix] Ensure
compile.elixirpurges and deletes modules before compiling - [Mix] Do not crash on malformed proxy env var
- [Stream] Ensure
chunk/4works correctly when halted - [System] Do not allow relative paths in
System.cmd/3as documented - [System] Fix
:stderr_to_stdoutoption inSystem.cmd/3
v1.0.0
v0.15.1
Enhancements
- [GenEvent] Support
:ackmode for GenEvent streams - [Inspect] Support
:baseoption ininspect/2to choose the base (:binary,:octal,:decimalor:hex) numbers a printed - [Kernel] Print warnings when used
?with characters with escape codes - [Logger] Add SASL log forwarding option to Logger
- [Logger] Add
$padlevelto option Logger formatter - [Logger] Backends receive the exact handler value when added, allowing a key to be passed for configuration lookup
- [Logger] Add
Logger.flush/0to flush the Logger (useful for testing) - [Logger] Persist backends dynamically added or removed via
add_backend/2andremove_backend/2 - [Macro] Add
Macro.validate/1to recursively check if a value is a valid quoted expression - [Mix] Load mix deps only when there is a need to use them (this improves the timing for the majority of tasks in a Mix project)
- [Mix] Make the environment explicit on the success message generated after
escript.buildis invoked - [Mix] Load
config/config.exsinside escripts - [Mix] Store and check Elixir version requirement for generated archives
Bug fixes
- [CLI] Fix shell bugs when running on Windows with Cygwin or MinGW
- [Kernel] Modules compiled by Elixir now report the correct beam location when
:code.which/1is invoked. If the bytecode is only available in memory,:code.which/1returns:in_memory - [Kernel] Do not expand args for unknown functions/macros
- [Kernel] Ensure
defstruct,@attrinside and friends raise a nice error messages when values cannot be properly escaped - [Kernel] Do not raise conflicts on imports used from inside quotes
- [Logger] Metadata is now correctly merged on each
Logger.metadata/1call - [Logger] Use the Logger PID on
:error_loggerwrapper to avoid race conditions on shutdown - [Macro] Ensure bitstrings work with
Macro.escape/1 - [Mix] Ensure aliases are invoked on umbrella recursive tasks
- [Mix] Leave it up to the application to start the Logger after compilation
- [Mix] Accept more forms of git versions (like "git version 1.9.3 (Apple Git-50)")
- [Path] Do not normalize paths in
Path.join/2as normalization is beyond the scope of such function - [URI]
to_string/1now properly converts URI to strings when the schema is missing
Deprecations
- [Collectable] Having a function as collectable is deprecated
- [Module]
Module.function/3is deprecated, please use:erlang.make_fun/3instead
v0.15.0
Enhancements
- [Agent] Improve the Agent API to also accept functions that receive explicit module, function and arguments
- [IEx] Support
--werlcall on Windows - [Logger] Add
Logger - [Map] Add
Map.from_struct/1 - [Mix] Allow
--appflag to be passed tomix new - [Mix] Support lowercase
http(s)_proxyenvironment variables - [Mix] Allow
elixirc_pathsto also be given through the command line tomix compile.elixir - [String]
String.slice/2andString.slice/3have been optimized
Bug fixes
- [IEx] Ensure functions in
Kernel.SpecialFormsandIEx.Helpersare also auto-completed - [IEx] Ensure remote shells can be started with
--remsh - [Kernel] Correctly parse unary/binary operators regardless of number of spaces
- [Kernel] Ensure private functions are not exported
- [Protocol] Do not expose protocol convention on
assert_impl!/2 - [Regex] Do not consider include captures on
Regex.split/3results - [Stream] Implement the
Inspectprotocol for Streams so we do not leak the Stream representation
Deprecations
- [IEx] IEx color configuration expects a list of atoms instead of a string with colors separated by comma
- [Inspect]
Inspect.Algebra.surround_many/6now expects Inspect.Opts instead of an integer limit - [Inspect]
Inspect.Algebra.pretty/2is deprecated in favor ofInspect.Algebra.format/2that instead returns iodata. This function was used only by documentation examples and it is unlikely to affect actual code - [IO]
IO.ANSI.terminal?is deprecated in favor ofIO.ANSI.enabled? - [IO]
IO.ANSI.escape/2andIO.ANSI.escape_fragment/2is deprecated in favor ofIO.ANSI.format/2andIO.ANSI.format_fragment/2 - [Kernel] Leading
0for octals is deprecated in favor of0o - [Kernel]
0Xfor hexadecimals is deprecated in favor of0x - [Kernel]
0Bfor binaries is deprecated in favor of0b - [Mix] Mix color configuration expects a list of atoms instead of a string with colors separated by comma
- [String]
\NNN,\NNand\Nfor octals are deprecated inside string, sigils and chars in favor of hexadecimal entries with\x
Backwards incompatible changes
- [Kernel]
binding/1andbinding/2expecting a list were removed - [Regex] Do not consider include captures on
Regex.split/3results
v0.14.3
Enhancements
- [Access] Allow function access on
get_in/2andget_and_update_in/3 - [Enum] Add
Enum.sort_by/3 - [ExUnit] Match the line filter by proximity instead of exact match
- [Float] Support precision in
Float.ceil/1andFloat.floor/1 - [IO] Add
IO.(bin)read(device, :all) - [Kernel] Print a warning if a dangling
@docclause is found - [Mix] Use absolute symbolic links on Windows for
_buildinstead of copying - [Mix] Add
Mix.compilersthat returns all default compilers used by mix tasks - [Mix] Issue warning and reset mtime for source files from the future
- [Mix] Support task aliases in Mix
- [OptionParser] Add
OptionParser.split/1that splits a string into argv - [Record] Allow a record to be converted to a keyword list with
record(some_record) - [String] Improve performance of
String.split/1 - [Typespec] Allow
%Struct{}syntax to be used in typespecs - [Typespec] Allow
record(:record, fields)syntax to be used in typespecs
Bug fixes
- [IEx] Do not print ANSI sequences on
IEx.Helpers.clear/0if ANSI sequences are not supported - [Inspect] Ensure
Inspect.Algebra.to_doc/2doesn't go into a loop when there is a failure printing a struct - [Kernel]
|>,<<<,>>>and^^^made left associative in operator table - [Kernel]
<,>,<=,>=given higher precedence than comparison operators (==,!=, etc) in the operator table - [Kernel] Run command line and escripts in a process that does not trap exits
- [Kernel] Fix a bug where Mix paths had higher priority than CLI ones, causing protocol consolidations to not be properly loaded
- [Kernel] Fix wording on error messages when a check/guard always passes or always fails
- [Kernel] Fix a bug where an unused function warning was printed even when the function was used via
defoverridable - [Kernel] Improve typespecs so they don't generate supertype dialyzer warnings
- [Macro]
to_stringcorrectly displays sigils - [Mix] Ensure Mix dependencies are not compiled every second time when
mix deps.compileis invoked - [Mix] Fix a bug where
Mix.shell.error/1and friends choked when printing a map - [Mix] Ensure multiple
@external_resourceentries are read by Mix compilers - [Mix] Fix a bug where tasks for umbrella projects were not properly reenabled
- [Stream] Fix bug when
flat_mapis used inside anotherflat_mapwith an Enumerable - [Typespec] Fix a bug where the
listtypespec was incorrectly rendered as[]
Soft deprecations (no warnings emitted)
- [Kernel] Using a list for bitstring modifiers is deprecated (as in
<<x :: [little, utf16]>>), please use-as the separator instead (as in<<x :: little-utf16>>) - [System]
System.cmd/1is deprecated in favor ofSystem.cmd/3
Deprecations
- [Mix]
mix escriptizeis deprecated in favor ofescript.build - [Mix]
mix local.installandmix local.uninstallhave been deprecated in favor ofmix archive.installandmix archive.uninstallrespectively - [Mix]
:embed_extra_appsfor escripts is deprecated, instead list the dependencies insidedef application - [System] Giving a char list to
System.find_executable/1is deprecated
Backwards incompatible changes
- [Access] No longer fill in missing intermediate values with empty maps
- [Float]
Float.ceil/2andFloat.floor/2now always returns floats and no longer accept integers - [Kernel]
defstructno longer automatically defines a type - [Kernel]
exit(integer)is no longer supported from scripts to configure the exit signal. Useexit({:shutdown, integer})instead - [Kernel] Default argument values have to be defined in a function head if the function has multiple clauses
- [Mix]
mix archive.buildreplaces the functionality ofmix archive,mix archivenow lists locally installed archives - [Mix]
Mix.shell.info/1no longer automatically escape ANSI sequences. Instead if has to be explicitly enabled with theansi: trueoption - [OptionParser]
--no-SWITCHare only allowed for declared booleans switches