Skip to content

Commit e6c7720

Browse files
committed
Update CHANGELOG
1 parent 41cf575 commit e6c7720

File tree

2 files changed

+40
-10
lines changed

2 files changed

+40
-10
lines changed

CHANGELOG.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ At the moment, Elixir developers will interact with set-theoretic types only thr
1212

1313
* `map()` and structs - maps can be "closed" or "open". Closed maps only allow the specified allows keys, such as `%{key: atom(), value: integer()}`. Open maps support any other keys in addition to the ones listed and their definition starts with `...`, such as `%{..., key: atom(), value: integer()}`. Structs are closed maps with the `__struct__` key.
1414

15-
* `tuple()`, `list()`, and `function()` - currently they are modelled as indivisible types. The next Elixir versions will also introduce fine-grained types here.
15+
* `tuple()`, `list()`, and `function()` - currently they are modelled as indivisible types. The next Elixir versions will also introduce fine-grained support to them.
1616

1717
We focused on atoms and maps on this initial release as they are respectively the simplest and the most complex types representations, so we can stress the performance of the type system and quality of error messages. Modelling these types will also provide the most immediate benefits to Elixir developers. Assuming there is a variable named `user`, holding a `%User{}` struct with an `address` field, Elixir v1.17 will emit the following warnings at compile-time:
1818

@@ -36,15 +36,39 @@ We focused on atoms and maps on this initial release as they are respectively th
3636

3737
* Accessing a field that is not defined in a rescued exception
3838

39-
These new warnings help Elixir developers find bugs earlier and give more confidence when refactoring code, especially around maps and structs. While some of these warnings were emitted in the past, they were discovered using syntax analysis. The new warnings are more reliable, precise, and with better error messages. Keep in mind that not all maps have statically known keys, and the Elixir typechecker does not track types across all variables and function calls yet.
39+
These new warnings help Elixir developers find bugs earlier and give more confidence when refactoring code, especially around maps and structs. While some of these warnings were emitted in the past, they were discovered using syntax analysis. The new warnings are more reliable, precise, and with better error messages. Keep in mind that not all maps have statically known keys, and the Elixir typechecker only infers types from patterns at the moment.
4040

41-
Future Elixir versions will continue inferring more types and type checking more constructs, bringing Elixir developers more warnings and quality of life improvements without changes to code. For more details, see our new [reference document on gradual set-theoretic types](https://hexdocs.pm/elixir/main/gradual-set-theoretic-types.html).
41+
Future Elixir versions will infer and type check more constructs, bringing Elixir developers more warnings and quality of life improvements without changes to code. For more details, see our new [reference document on gradual set-theoretic types](https://hexdocs.pm/elixir/main/gradual-set-theoretic-types.html).
4242

43-
The type system was made possible thanks to a partnership between [CNRS](https://www.cnrs.fr/) and [Remote](https://remote.com/). The development work is currently sponsored by [Fresha](https://www.fresha.com/), [Starfish*](https://starfish.team/), and [Dashbit](https://dashbit.co/).
43+
The type system was made possible thanks to a partnership between [CNRS](https://www.cnrs.fr/) and [Remote](https://remote.com/). The development work is currently sponsored by [Fresha](https://www.fresha.com/), [Starfish*](https://starfish.team/), and [Dashbit](https://dashbit.co/).
44+
45+
## Erlang/OTP support
46+
47+
This release adds support for Erlang/OTP 27 and drops support for Erlang/OTP 24. We recommend Elixir developers to migrate to Erlang/OTP 26+ or later, especially on Windows. Support for WERL (a graphical user interface for the Erlang terminal on Windows) will be removed in Elixir v1.18.
4448

4549
## Adding `Duration` and `shift/2` functions
4650

47-
TODO.
51+
Elixir introduces the `Duration` data type and APIs to shift dates, times, and date times by a given duration, considering different calendars and time zones.
52+
53+
```elixir
54+
iex> Date.shift(~D[2016-01-31], month: 2)
55+
~D[2016-03-31]
56+
```
57+
58+
Note the operation is called `shift` (instead of `add`) since working with durations does not obey properties such as associativity. For instance, adding one month and then one month does not give the same result as adding two months:
59+
60+
```elixir
61+
iex> ~D[2016-01-31] |> Date.shift(month: 1) |> Date.shift(month: 1)
62+
~D[2016-03-29]
63+
```
64+
65+
Still, durations are essential for building intervals, recurring events, and modelling scheduling complexities found in the world around us. For `DateTime`s, Elixir will correctly deal with time zone changes (such as Daylight Saving Time), but provisions are also available in case you want to surface conflicts (for example, you shifted to a wall clock that does not exist, because the clock has been moved forward by one hour). See `DateTime.shift/2` for examples.
66+
67+
Finally, a new `Kernel.to_timeout/1` function has been added, which helps developers normalize durations and integers to a timeout used by Process APIs. For example, to send a message after one hour, one can now write:
68+
69+
```elixir
70+
Process.send_after(pid, :wake_up, to_timeout(hour: 1))
71+
```
4872

4973
## v1.17.0-dev
5074

@@ -53,7 +77,9 @@ TODO.
5377
#### Elixir
5478

5579
* [Access] Add `Access.find/1` that mirrors `Enum.find/2`
80+
* [Code] Support cursor inside fn/rescue/catch/else/after inside `Code.Fragment.container_cursor_to_quoted/2`
5681
* [Date] Add `Date.shift/2` to shift dates with duration and calendar-specific semantics
82+
* [Date] Allow `Date` to accept years outside of `-9999..9999` range
5783
* [DateTime] Add `DateTime.shift/2` to shift datetimes with duration and calendar-specific semantics
5884
* [Duration] Add a new `Duration` data type
5985
* [GenServer] Add `c:GenServer.format_status/1` callback
@@ -100,6 +126,9 @@ TODO.
100126
* [Code] Address a bug where AST nodes for `(a -> b)` were not wrapped as part of the literal encoder
101127
* [Kernel] Resolve inconsistencies of how `..` and `...` are handled at the AST level
102128
* [Kernel] Fix parsing precedence of ambiguous operators followed by containers
129+
* [Kernel] Do not expand code in `quote bind_quoted: ...` twice
130+
* [Kernel] Respect `:line` property when `:file` is given as option to `quote`
131+
* [Module] Return default value in `Module.get_attribute/3` for persisted attributes which have not yet been written to
103132

104133
#### IEx
105134

lib/elixir/lib/calendar/datetime.ex

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,10 +1682,11 @@ defmodule DateTime do
16821682
16831683
Allowed units are: `:year`, `:month`, `:week`, `:day`, `:hour`, `:minute`, `:second`, `:microsecond`.
16841684
1685-
This operation is equivalent to shifting the datetime wall clock (in other words,
1686-
the values as we see them printed), then applying the time zone offset before
1687-
computing the new time zone. This ensures `shift/3` always returns a valid
1688-
datetime.
1685+
This operation is equivalent to shifting the datetime wall clock
1686+
(in other words, the value as someone in that timezone would see
1687+
on their watch), then applying the time zone offset to convert it
1688+
to UTC, and finally computing the new timezone in case of shifts.
1689+
This ensures `shift/3` always returns a valid datetime.
16891690
16901691
On the other hand, time zones that observe "Daylight Saving Time"
16911692
or other changes, across summer/winter time will add/remove hours
@@ -1700,7 +1701,7 @@ defmodule DateTime do
17001701
#=> #DateTime<2018-11-04 01:00:00-08:00 PST America/Los_Angeles>
17011702
17021703
In case you don't want these changes to happen automatically or you
1703-
want to surface timezone conflicts to the user, you can shift
1704+
want to surface time zone conflicts to the user, you can shift
17041705
the datetime as a naive datetime and then use `from_naive/2`:
17051706
17061707
dt |> NaiveDateTime.shift(duration) |> DateTime.from_naive(dt.time_zone)

0 commit comments

Comments
 (0)