@@ -67,6 +67,17 @@ and the combination of module path + access path is an "import path".)
67
67
68
68
See ` ImportPath ` and the types nested inside it for more on this.
69
69
70
+ ## access pattern
71
+
72
+ Defines how some particular storage (a property or a subscript) is accessed.
73
+ For example, when accessing a property ` let y = a.x ` , the compiler could potentially
74
+ use ` get ` accessor or the ` _read ` accessor. Similarly, for a modification like
75
+ ` a.x += 1 ` , the compiler could use ` get ` + ` set ` or it could use ` _modify ` .
76
+
77
+ The access pattern can differ for call-sites which can/cannot see the underlying
78
+ implementation. Clients which cannot see the underlying implementation are said
79
+ to use the conservative access pattern.
80
+
70
81
## archetype
71
82
72
83
A placeholder for a generic parameter or an associated type within a
@@ -476,6 +487,38 @@ See [mandatory passes](#mandatory-passes--mandatory-optimizations).
476
487
An implicit representation change that occurs when a value is used with
477
488
a different [ abstraction pattern] ( #abstraction-pattern ) from its current representation.
478
489
490
+ ## realization
491
+
492
+ The process of initializing an ObjC class for use by the ObjC runtime.
493
+ This consists of allocating runtime tracking data, fixing up method lists
494
+ and attaching categories.
495
+
496
+ This is distinct from the initialization performed by ` +initialize ` , which
497
+ happens only when the first message (other than ` +load ` ) is sent to the class.
498
+
499
+ The order of operations is: realization, followed by ` +load ` (if present),
500
+ followed by ` +initialize ` . There are few cases where these can happen
501
+ at different times.
502
+
503
+ - Common case (no ` +load ` or special attributes): Realization is lazy and
504
+ happens when the first message is sent to a class. After that, ` +initialize `
505
+ is run.
506
+ - If the class has a ` +load ` method: ` +load ` , as the name suggests, runs at
507
+ load time; it is the ObjC equivalent of a static initializer in C++. For
508
+ such a class, realization eagerly happens at load time before ` +load ` runs.
509
+ (Fun aside: C++ static initializers run after ` +load ` .) ` +initialize ` still
510
+ runs lazily on the first message.
511
+ - If the class is marked [ ` @_objc_non_lazy_realization ` ] ( /docs/ReferenceGuides/UnderscoredAttributes.md#_objc_non_lazy_realization ) :
512
+ Realization happens at load time. ` +initialize ` still runs lazily on the first
513
+ message.
514
+
515
+ It's possible to create a class that is realized but not initialized by
516
+ using a runtime function like ` objc_getClass ` before the class has been used.
517
+
518
+ See also: Mike Ash's blog post on
519
+ [ Objective-C Class Loading and Initialization] ( https://www.mikeash.com/pyblog/friday-qa-2009-05-22-objective-c-class-loading-and-initialization.html ) ,
520
+ which covers ` +load ` and ` +initialize ` in more detail.
521
+
479
522
## refutable pattern
480
523
481
524
A pattern that may not always match. These include patterns such as:
0 commit comments