Skip to content

Commit 9e96966

Browse files
author
José Valim
committed
Add a deprecation note to records, split deprecated modules
1 parent 845a3d1 commit 9e96966

File tree

7 files changed

+548
-810
lines changed

7 files changed

+548
-810
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,7 @@ defmodule Kernel do
25712571
end
25722572
end
25732573

2574-
Record.access(atom, fields, args, caller)
2574+
Record.Deprecated.access(atom, fields, args, caller)
25752575
false ->
25762576
case caller.in_match? or caller.in_guard? do
25772577
true -> raise ArgumentError, message: "dynamic access cannot be invoked inside match and guard clauses"
@@ -3010,6 +3010,10 @@ defmodule Kernel do
30103010
end
30113011

30123012
@doc ~S"""
3013+
Note: Records are mostly deprecated and being slowly removed from
3014+
the language. The set of supported record operations will be
3015+
maintained in the Record module.
3016+
30133017
Exports a module with a record definition and runtime operations.
30143018
30153019
Please see the `Record` module's documentation for an introduction
@@ -3123,12 +3127,16 @@ defmodule Kernel do
31233127
"""
31243128
defmacro defrecord(name, fields, do_block \\ []) do
31253129
case is_list(fields) and Keyword.get(fields, :do, false) do
3126-
false -> Record.defrecord(name, fields, do_block)
3127-
other -> Record.defrecord(name, Keyword.delete(fields, :do), do: other)
3130+
false -> Record.Deprecated.defrecord(name, fields, do_block)
3131+
other -> Record.Deprecated.defrecord(name, Keyword.delete(fields, :do), do: other)
31283132
end
31293133
end
31303134

31313135
@doc ~S"""
3136+
Note: Records are mostly deprecated and being slowly removed from
3137+
the language. The set of supported record operations will be
3138+
maintained in the Record module.
3139+
31323140
Defines a set of private macros to manipulate a record definition.
31333141
31343142
This macro defines a set of macros private to the current module to
@@ -3185,7 +3193,7 @@ defmodule Kernel do
31853193
31863194
"""
31873195
defmacro defrecordp(name, tag \\ nil, fields) do
3188-
Record.defrecordp(name, Macro.expand(tag, __CALLER__), fields)
3196+
Record.Deprecated.defrecordp(name, Macro.expand(tag, __CALLER__), fields)
31893197
end
31903198

31913199
@doc """
@@ -3304,7 +3312,7 @@ defmodule Kernel do
33043312
end)
33053313

33063314
fields = quote do: [__exception__: :__exception__] ++ unquote(fields)
3307-
record = Record.defrecord(name, fields, do_block)
3315+
record = Record.Deprecated.defrecord(name, fields, do_block)
33083316

33093317
quote do
33103318
{ :module, name, _, _ } = unquote(record)

0 commit comments

Comments
 (0)