File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -964,7 +964,9 @@ Deprecated or removed
964964
965965 * ` findin(a, b) ` has been deprecated in favor of ` findall(occursin(b), a) ` ([ #24673 ] ).
966966
967- * ` module_name ` has been deprecated in favor of a new, general ` nameof ` function ([ #25622 ] ).
967+ * ` module_name ` has been deprecated in favor of a new, general ` nameof ` function. Similarly,
968+ the unexported ` Base.function_name ` has been deprecated in favor of a ` nameof ` method
969+ ([ #25622 ] ).
968970
969971 * The module ` Random.dSFMT ` is renamed ` Random.DSFMT ` ([ #25567 ] ).
970972
Original file line number Diff line number Diff line change @@ -1626,6 +1626,7 @@ export readandwrite
16261626
16271627# PR #25622
16281628@deprecate module_name (m:: Module ) nameof (m)
1629+ @deprecate function_name (f:: Function ) nameof (f) false
16291630
16301631# PR #25196
16311632@deprecate_binding ObjectIdDict IdDict{Any,Any}
Original file line number Diff line number Diff line change @@ -1017,11 +1017,11 @@ end
10171017
10181018# function reflection
10191019"""
1020- Base.function_name (f::Function) -> Symbol
1020+ nameof (f::Function) -> Symbol
10211021
10221022Get the name of a generic `Function` as a symbol, or `:anonymous`.
10231023"""
1024- function_name (f:: Function ) = typeof (f). name. mt. name
1024+ nameof (f:: Function ) = typeof (f). name. mt. name
10251025
10261026functionloc (m:: Core.MethodInstance ) = functionloc (m. def)
10271027
Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ Base.fullname
339339Base.names
340340Core.nfields
341341Base.isconst
342- Base.function_name
342+ Base.nameof(::Function)
343343Base.functionloc(::Any, ::Any)
344344Base.functionloc(::Method)
345345Base.@functionloc
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ const COMMAND_GROUPS =
219219
220220const COMMAND_GROUP = Dict (command=> group for (group, commands) in COMMAND_GROUPS for command in commands)
221221command_group (command:: Symbol ) = get (COMMAND_GROUP, command, :nogroup )
222- command_group (command:: Function ) = command_group (Base. function_name (command))
222+ command_group (command:: Function ) = command_group (Base. nameof (command))
223223
224224# return true if command should keep active a region
225225function preserve_active (command:: Symbol )
Original file line number Diff line number Diff line change 266266 using . TestMod7648
267267 @test Base. binding_module (@__MODULE__ , :a9475 ) == TestMod7648. TestModSub9475
268268 @test Base. binding_module (@__MODULE__ , :c7648 ) == TestMod7648
269- @test Base . function_name (foo7648) == :foo7648
269+ @test nameof (foo7648) == :foo7648
270270 @test parentmodule (foo7648, (Any,)) == TestMod7648
271271 @test parentmodule (foo7648) == TestMod7648
272272 @test parentmodule (foo7648_nomethods) == TestMod7648
You can’t perform that action at this time.
0 commit comments