Skip to content

Commit b1e031e

Browse files
committed
refine the docstring a bit
1 parent 3f6d21c commit b1e031e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

base/experimental.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ end
330330
include("opaque_closure.jl")
331331

332332
"""
333-
Base.Experimental.@overlay mt [function def]
333+
Base.Experimental.@overlay mt def
334334
335335
Define a method and add it to the method table `mt` instead of to the global method table.
336336
This can be used to implement a method override mechanism. Regular compilation will not
@@ -366,7 +366,7 @@ macro overlay(mt, def)
366366
end
367367

368368
"""
369-
Base.Experimental.@consistent_overlay mt [function def]
369+
Base.Experimental.@consistent_overlay mt def
370370
371371
This macro operates almost identically to [`Base.Experimental.@overlay`](@ref), defining a
372372
new overlay method. The key difference with this macro is that it informs the compiler that
@@ -375,18 +375,20 @@ non-overlayed method call.
375375
376376
More formally, when evaluating a generic function call ``f(x)`` at a specific world age
377377
``i``, if a regular method call ``fᵢ(x)`` is redirected to an overlay method call ``fᵢ′(x)``
378-
defined by this macro, it must be ensured that ``fᵢ(x) ≡ fᵢ′(x)``.
378+
defined by this macro, ``fᵢ(x)`` and ``fᵢ′(x)`` are considered `:consistent` if the following
379+
conditions are met:
380+
- If ``fᵢ(x)`` returns a value ``y``, then ``fᵢ′(x)`` also returns some value ``yᵢ``, and ``y ≡ yᵢ`` holds.
381+
- If ``fᵢ(x)`` throws an exception, then ``fᵢ′(x)`` also throws some exception.
379382
380383
For a detailed definition of `:consistent`-cy, consult the corresponding section in
381384
[`Base.@assume_effects`](@ref).
382385
383386
!!! note
384387
Note that the requirements for `:consistent`-cy include not only that the return values
385-
are egal, but also that the manner of termination is the same.
386-
However, it's important to aware that when they throw exceptions, the exceptions
387-
themselves don't necessarily have to be egal as explained in the note of `:consistent`.
388-
In other words, if ``fᵢ(x)`` throws an exception, ``fᵢ′(x)`` is required to also throw
389-
one, but the exact exceptions may differ.
388+
are egal, but also that the manner of termination is the same. However, it's important
389+
to aware that when they throw exceptions, the exceptions themselves don't necessarily
390+
have to be egal. In other words, if ``fᵢ(x)`` throws an exception, ``fᵢ′(x)`` is
391+
required to also throw one, but the exact exceptions may differ.
390392
391393
!!! note
392394
Please note that the `:consistent`-cy requirement applies not to method itself but to
@@ -447,11 +449,11 @@ let new_mt(name::Symbol, mod::Module) = begin
447449
end
448450

449451
"""
450-
Experimental.@MethodTable(name)
452+
Base.Experimental.@MethodTable name
451453
452454
Create a new MethodTable in the current module, bound to `name`. This method table can be
453-
used with the [`Experimental.@overlay`](@ref) macro to define methods for a function without
454-
adding them to the global method table.
455+
used with the [`Base.Experimental.@overlay`](@ref) macro to define methods for a function
456+
without adding them to the global method table.
455457
"""
456458
:@MethodTable
457459

0 commit comments

Comments
 (0)