Skip to content

Commit c1a7c03

Browse files
committed
Updated docs to use __record__(:index) instead of __index__
1 parent 5b754c8 commit c1a7c03

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* [Enum] Receiving the index of iteration in `Enum.map/2` and `Enum.each/2` is deprecated in favor of `Stream.with_index/1`
2424
* [File] `File.iterator/1` and `File.biniterator/1` are deprecated in favor of `IO.stream/1` and `IO.binstream/1`
2525
* [File] `File.iterator!/2` and `File.biniterator!/2` are deprecated in favor of `File.stream!/2` and `File.binstream!/2`
26+
* [Record] `Record.__index__/2` deprecated in favor of `Record.__record__(:index, key)`
2627

2728
* backwards incompatible changes
2829
* [Kernel] The `Binary.Inspect` protocol has been renamed to `Inspect`

lib/elixir/lib/kernel.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,12 +1517,12 @@ defmodule Kernel do
15171517
#=> [name: nil, age: 0]
15181518
15191519
In order to quickly access the index of a field, one can use
1520-
the `__index__` function:
1520+
the `__record__` function with `:index` as the first argument:
15211521
1522-
User.__index__(:age)
1522+
User.__record__(:index, :age)
15231523
#=> 2
15241524
1525-
User.__index__(:unknown)
1525+
User.__record__(:index, :unknown)
15261526
#=> nil
15271527
15281528
## Compile-time introspection

0 commit comments

Comments
 (0)