mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 06:00:35 +03:00
[std/exception] Use PANEL macro to group paragraphs
This commit is contained in:
parent
41f6a45d28
commit
a2df1e6733
1 changed files with 11 additions and 6 deletions
|
@ -416,13 +416,16 @@ void assertThrown(T : Throwable = Exception, E)
|
||||||
Returns: `value`, if `cast(bool) value` is true. Otherwise,
|
Returns: `value`, if `cast(bool) value` is true. Otherwise,
|
||||||
depending on the chosen overload, `new Exception(msg)`, `dg()` or `ex` is thrown.
|
depending on the chosen overload, `new Exception(msg)`, `dg()` or `ex` is thrown.
|
||||||
|
|
||||||
Note:
|
$(PANEL
|
||||||
`enforce` is used to throw exceptions and is therefore intended to
|
$(NOTE `enforce` is used to throw exceptions and is therefore intended to
|
||||||
aid in error handling. It is $(I not) intended for verifying the logic
|
aid in error handling. It is $(I not) intended for verifying the logic
|
||||||
of your program. That is what `assert` is for. Also, do not use
|
of your program - that is what `assert` is for.)
|
||||||
|
|
||||||
|
Do not use
|
||||||
`enforce` inside of contracts (i.e. inside of `in` and `out`
|
`enforce` inside of contracts (i.e. inside of `in` and `out`
|
||||||
blocks and `invariant`s), because contracts are compiled out when
|
blocks and `invariant`s), because contracts are compiled out when
|
||||||
compiling with $(I -release).
|
compiling with $(I -release).
|
||||||
|
)
|
||||||
|
|
||||||
If a delegate is passed, the safety and purity of this function are inferred
|
If a delegate is passed, the safety and purity of this function are inferred
|
||||||
from `Dg`'s safety and purity.
|
from `Dg`'s safety and purity.
|
||||||
|
@ -870,11 +873,12 @@ return to!(string)(sneaky); // not that sneaky anymore
|
||||||
|
|
||||||
The call will duplicate the array appropriately.
|
The call will duplicate the array appropriately.
|
||||||
|
|
||||||
Note that checking for uniqueness during compilation is
|
$(PANEL
|
||||||
|
$(NOTE Checking for uniqueness during compilation is
|
||||||
possible in certain cases, especially when a function is
|
possible in certain cases, especially when a function is
|
||||||
marked as a pure function. The following example does not
|
marked (or inferred) as `pure`. The following example does not
|
||||||
need to call `assumeUnique` because the compiler can infer the
|
need to call `assumeUnique` because the compiler can infer the
|
||||||
uniqueness of the array in the pure function:
|
uniqueness of the array in the pure function:)
|
||||||
|
|
||||||
$(RUNNABLE_EXAMPLE
|
$(RUNNABLE_EXAMPLE
|
||||||
----
|
----
|
||||||
|
@ -894,6 +898,7 @@ For more on infering uniqueness see the $(B unique) and
|
||||||
$(B lent) keywords in the
|
$(B lent) keywords in the
|
||||||
$(HTTP www.cs.cmu.edu/~aldrich/papers/aldrich-dissertation.pdf, ArchJava)
|
$(HTTP www.cs.cmu.edu/~aldrich/papers/aldrich-dissertation.pdf, ArchJava)
|
||||||
language.
|
language.
|
||||||
|
)
|
||||||
|
|
||||||
The downside of using `assumeUnique`'s
|
The downside of using `assumeUnique`'s
|
||||||
convention-based usage is that at this time there is no
|
convention-based usage is that at this time there is no
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue