7373#define COROUTINE_ACCESSOR (ID, KEYWORD ) OPAQUE_ACCESSOR(ID, KEYWORD)
7474#endif
7575
76+ // / EXPERIMENTAL_COROUTINE_ACCESSOR(ID, KEYWORD, FEATURE)
77+ // / The given coroutine accessor is experimental.
78+ // /
79+ // / Defaults to COROUTINE_ACCESSOR(ID, KEYWORD)
80+ #ifndef EXPERIMENTAL_COROUTINE_ACCESSOR
81+ #define EXPERIMENTAL_COROUTINE_ACCESSOR (ID, KEYWORD, FEATURE ) COROUTINE_ACCESSOR(ID, KEYWORD)
82+ #endif
83+
7684// / ANY_ADDRESSOR(ID, KEYWORD)
7785// / The given keyword corresponds to an addressor of the given kind.
7886// /
108116#define INIT_ACCESSOR (ID, KEYWORD ) SINGLETON_ACCESSOR(ID, KEYWORD)
109117#endif
110118
111- // Suppress entries for accessors which can't be written in source code.
112- #ifndef SUPPRESS_ARTIFICIAL_ACCESSORS
113- #define SUPPRESS_ARTIFICIAL_ACCESSORS 0
114- #endif
115-
116119// / This is a getter: a function that is called when a value is loaded
117120// / from the storage. It returns an owned value of the storage type.
118121// /
@@ -150,6 +153,14 @@ OBJC_ACCESSOR(Set, set)
150153// / one can always be synthesized (even if the storage type is move-only).
151154COROUTINE_ACCESSOR(Read, _read)
152155
156+ // / This is a read accessor: a yield-once coroutine which is called when a
157+ // / value is loaded from the storage, like a getter, but which works
158+ // / by yielding a borrowed value of the storage type.
159+ // /
160+ // / If the storage is not implemented with a read accessor then
161+ // / one can always be synthesized (even if the storage type is move-only).
162+ EXPERIMENTAL_COROUTINE_ACCESSOR(Read2, read, CoroutineAccessors)
163+
153164// / This is a modify accessor: a yield-once coroutine which is called when a
154165// / the storage is modified which works by yielding an inout value
155166// / of the storage type.
@@ -158,6 +169,14 @@ COROUTINE_ACCESSOR(Read, _read)
158169// / one can be synthesized if the storage is mutable at all.
159170COROUTINE_ACCESSOR(Modify, _modify)
160171
172+ // / This is a modify accessor: a yield-once coroutine which is called when a
173+ // / the storage is modified which works by yielding an inout value
174+ // / of the storage type.
175+ // /
176+ // / If the storage is not implemented with a modify accessor then
177+ // / one can be synthesized if the storage is mutable at all.
178+ EXPERIMENTAL_COROUTINE_ACCESSOR(Modify2, modify, CoroutineAccessors)
179+
161180// / This is a willSet observer: a function which "decorates" an
162181// / underlying assignment operation by being called prior to the
163182// / operation when a value is assigned to the storage.
@@ -210,6 +229,7 @@ LAST_ACCESSOR(Init)
210229#undef OBJC_ACCESSOR
211230#undef OPAQUE_ACCESSOR
212231#undef COROUTINE_ACCESSOR
232+ #undef EXPERIMENTAL_COROUTINE_ACCESSOR
213233#undef OBSERVING_ACCESSOR
214234#undef SINGLETON_ACCESSOR
215235#undef ACCESSOR
0 commit comments