@@ -37,7 +37,7 @@ Type safety enables you to be clear about
3737the types of values your code works with.
3838If part of your code requires a ` String ` ,
3939type safety prevents you from passing it an ` Int ` by mistake.
40- Data safety ensures that you work with valid data only,
40+ Memory safety ensures that you work with valid data only,
4141not uninitialized memory or deinitialized objects,
4242and ensures that you work with that data in safe ways ---
4343even in programs that run multiple pieces of code at the same time.
@@ -1796,22 +1796,26 @@ if let definiteString = assumedString {
17961796 ```
17971797-->
17981798
1799- ## Data Safety
1799+ ## Memory Safety
18001800
18011801In addition to the checks that prevent type mismatches,
18021802described above in < doc:TheBasics#Type-Safety-and-Type-Inference > ,
18031803Swift also protects code against working with invalid memory.
1804- This protection is known as * data safety * or * memory safety*
1804+ This protection is known as * memory safety*
18051805and includes the following requirements:
18061806
1807- - Values are set before being read;
1808- code doesn't interact with uninitialized regions of memory.
1809- - Arrays and buffers are accessed only at valid indexes,
1810- never out of bounds.
1807+ - Values are set before being read.
1808+ The protection against interacting with uninitialized regions of memory
1809+ is also known as * definite initialization* .
1810+ - Arrays and buffers are accessed only at valid indexes.
1811+ The protection against out-of-bounds access
1812+ is also known as * bounds safety* .
18111813- Memory is accessed only during the value’s lifetime,
1812- preventing use-after-free errors.
1813- - Access to memory overlaps only in provably safe ways;
1814- concurrent code doesn't create possible data races.
1814+ The protection against use-after-free errors
1815+ is also known as * lifetime safety* .
1816+ - Access to memory overlaps only in provably safe ways.
1817+ The protection against possible data races in concurrent code
1818+ is also known as * thread safety* .
18151819
18161820If you've worked in languages that don't provide these guarantees,
18171821you may be familiar with some of the errors and bugs
@@ -1820,7 +1824,7 @@ If you haven't encountered these issues, that's ok;
18201824safe code in Swift avoids these problems.
18211825For information about how Swift ensures you set initial values,
18221826see < doc:Initialization > ,
1823- and for information about how Swift checks data safety in concurrent code,
1827+ and for information about how Swift checks memory safety in concurrent code,
18241828see < doc:Concurrency > .
18251829
18261830Sometimes you need to work outside of the bounds of safety ---
0 commit comments