Skip to content

Commit

Permalink
minor tweaks on @assume_effects docs (JuliaLang#45675)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Jun 14, 2022
1 parent 6c97a48 commit 75f042f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions base/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ The following `setting`s are supported.
# Extended help
---
# `:consistent`
## `:consistent`
The `:consistent` setting asserts that for egal (`===`) inputs:
- The manner of termination (return value, exception, non-termination) will always be the same.
Expand Down Expand Up @@ -472,7 +472,7 @@ The `:consistent` setting asserts that for egal (`===`) inputs:
itself is not required to meet the egality requirement specified above.
---
# `:effect_free`
## `:effect_free`
The `:effect_free` setting asserts that the method is free of externally semantically
visible side effects. The following is an incomplete list of externally semantically
Expand Down Expand Up @@ -502,7 +502,7 @@ were not executed.
valid for all world ages and limit use of this assertion accordingly.
---
# `:nothrow`
## `:nothrow`
The `:nothrow` settings asserts that this method does not terminate abnormally
(i.e. will either always return a value or never return).
Expand All @@ -516,7 +516,7 @@ The `:nothrow` settings asserts that this method does not terminate abnormally
`MethodErrors` and similar exceptions count as abnormal termination.
---
# `:terminates_globally`
## `:terminates_globally`
The `:terminates_globally` settings asserts that this method will eventually terminate
(either normally or abnormally), i.e. does not loop indefinitely.
Expand All @@ -531,7 +531,7 @@ The `:terminates_globally` settings asserts that this method will eventually ter
on a method that *technically*, but not *practically*, terminates.
---
# `:terminates_locally`
## `:terminates_locally`
The `:terminates_locally` setting is like `:terminates_globally`, except that it only
applies to syntactic control flow *within* the annotated method. It is thus
Expand All @@ -542,7 +542,7 @@ non-termination if the method calls some other method that does not terminate.
`:terminates_globally` implies `:terminates_locally`.
---
# `:notaskstate`
## `:notaskstate`
The `:notaskstate` setting asserts that the method does not use or modify the
local task state (task local storage, RNG state, etc.) and may thus be safely
Expand All @@ -569,7 +569,7 @@ moved between tasks without observable results.
may still be dead-code-eliminated and thus promoted to `:total`.
---
# `:foldable`
## `:foldable`
This setting is a convenient shortcut for the set of effects that the compiler
requires to be guaranteed to constant fold a call at compile time. It is
Expand All @@ -586,7 +586,7 @@ currently equivalent to the following `setting`s:
must consistently throw given the same argument values.
---
# `:total`
## `:total`
This `setting` is the maximum possible set of effects. It currently implies
the following other `setting`s:
Expand All @@ -598,21 +598,21 @@ the following other `setting`s:
!!! warning
`:total` is a very strong assertion and will likely gain additional semantics
in future versions of julia (e.g. if additional effects are added and included
in future versions of Julia (e.g. if additional effects are added and included
in the definition of `:total`). As a result, it should be used with care.
Whenever possible, prefer to use the minimum possible set of specific effect
assertions required for a particular application. In cases where a large
number of effect overrides apply to a set of functions, a custom macro is
recommended over the use of `:total`.
---
## Negated effects
Effect names may be prefixed by `!` to indicate that the effect should be removed
from an earlier meta effect. For example, `:total !:nothrow` indicates that while
the call is generally total, it may however throw.
---
## Comparison to `@pure`
`@assume_effects :foldable` is similar to [`@pure`](@ref) with the primary
Expand Down

0 comments on commit 75f042f

Please sign in to comment.