@@ -416,13 +416,16 @@ void assertThrown(T : Throwable = Exception, E)
416416 Returns: `value`, if `cast(bool) value` is true. Otherwise,
417417 depending on the chosen overload, `new Exception(msg)`, `dg()` or `ex` is thrown.
418418
419- Note:
420- `enforce` is used to throw exceptions and is therefore intended to
419+ $(PANEL
420+ $(NOTE `enforce` is used to throw exceptions and is therefore intended to
421421 aid in error handling. It is $(I not) intended for verifying the logic
422- of your program. That is what `assert` is for. Also, do not use
422+ of your program - that is what `assert` is for.)
423+
424+ Do not use
423425 `enforce` inside of contracts (i.e. inside of `in` and `out`
424426 blocks and `invariant`s), because contracts are compiled out when
425427 compiling with $(I -release).
428+ )
426429
427430 If a delegate is passed, the safety and purity of this function are inferred
428431 from `Dg`'s safety and purity.
@@ -836,7 +839,7 @@ string letters()
836839)
837840
838841The use in the example above is correct because `result`
839- was private to `letters` and is inaccessible in writing
842+ was private to `letters` and the memory it referenced can no longer be written to
840843after the function returns. The following example shows an
841844incorrect use of `assumeUnique`.
842845
@@ -859,22 +862,23 @@ string letters(char first, char last)
859862----
860863)
861864
862- The example above wreaks havoc on client code because it is
863- modifying arrays that callers considered immutable. To obtain an
865+ The example above wreaks havoc on client code because it modifies the
866+ returned array that the previous caller considered immutable. To obtain an
864867immutable array from the writable array `buffer`, replace
865868the last line with:
866869
867870----
868871return to!(string)(sneaky); // not that sneaky anymore
869872----
870873
871- The call will duplicate the array appropriately.
874+ The `to` call will duplicate the array appropriately.
872875
873- Note that checking for uniqueness during compilation is
876+ $(PANEL
877+ $(NOTE Checking for uniqueness during compilation is
874878possible in certain cases, especially when a function is
875- marked as a pure function . The following example does not
879+ marked (or inferred) as `pure` . The following example does not
876880need to call `assumeUnique` because the compiler can infer the
877- uniqueness of the array in the pure function:
881+ uniqueness of the array in the pure function:)
878882
879883$(RUNNABLE_EXAMPLE
880884----
@@ -894,6 +898,7 @@ For more on infering uniqueness see the $(B unique) and
894898$(B lent) keywords in the
895899$(HTTP www.cs.cmu.edu/~aldrich/papers/aldrich-dissertation.pdf, ArchJava)
896900language.
901+ )
897902
898903The downside of using `assumeUnique`'s
899904convention-based usage is that at this time there is no
0 commit comments