21 lines
875 B
Plaintext
21 lines
875 B
Plaintext
#! @file faults.sakura
|
|||
|
|
#! @author John Christman (sorakatadzuma@gmail.com)
|
||
|
|
#! @copyright Malunal Studios, LLC.
|
||
|
|
#! @license MIT
|
||
|
|
#!
|
||
|
|
#! Contains the fault std's containers stop with where they are asked for an
|
||
|
|
#! element they do not hold, which no switch leaves out, as `core`'s own
|
||
|
|
#! containers have.
|
||
|
|
|
||
|
|
module std::containers;
|
||
|
|
|
||
|
|
|
||
|
|
# Stops the program where one of std's containers is asked for an element past
|
||
|
|
# its end, as indexing a view outside its length does. A container calls it
|
||
|
|
# only where its check fails, so that where the check holds, it costs a compare,
|
||
|
|
# and the call is no more than its two numbers, which keeps what calls it short
|
||
|
|
# enough to be emitted where it is called. Where the check is, and what called
|
||
|
|
# it, the report of the stop names.
|
||
|
|
def past_end(index: u64, length: u64): void {
|
||
|
|
fault($"Index {index} is out of bounds: the length is {length}.");
|
||
|
|
}
|