respond to Matthias's comments
This commit is contained in:
parent
6a250fb089
commit
11927aea37
|
@ -142,14 +142,14 @@ expands to many nested definitions and expressions every time it is used.
|
||||||
@section{Unsafe: Beware}
|
@section{Unsafe: Beware}
|
||||||
|
|
||||||
Racket provides a number of unsafe operations that behave
|
Racket provides a number of unsafe operations that behave
|
||||||
the same as other, safe operations when given valid inputs,
|
like their related, safe variants but only when given valid inputs.
|
||||||
but eschewing checking for performance reasons and thus behave
|
They differ in that they eschew checking for performance reasons
|
||||||
unpredictably on invalid inputs.
|
and thus behave unpredictably on invalid inputs.
|
||||||
|
|
||||||
As one example, consider @racket[fx+] and @racket[unsafe-fx+].
|
As one example, consider @racket[fx+] and @racket[unsafe-fx+].
|
||||||
If you supply a non-@racket[fixnum?] to @racket[fx+], it raises
|
When @racket[fx+] is applied to a non-@racket[fixnum?], it raises
|
||||||
an error. If you supply a non-@racket[fixnum?] to @racket[unsafe-fx+],
|
an error. In contrast, when @racket[unsafe-fx+] is applied to a non-@racket[fixnum?],
|
||||||
it does not raise an error; instead it either returns a strange result
|
it does not raise an error. Instead it either returns a strange result
|
||||||
that may violate invariants of the run-time system and may cause
|
that may violate invariants of the run-time system and may cause
|
||||||
later operations (such as printing out the value) to crash Racket itself.
|
later operations (such as printing out the value) to crash Racket itself.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user