Skip to content

Commit 805a580

Browse files
SE-0400: State limitations (#2389)
* SE-0400: `init` accessors cannot be declared outside primary type declaration * SE-0400: `init` accessors can be ABI
1 parent fb90efb commit 805a580

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

proposals/0400-init-accessors.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,21 @@ init() {
491491
}
492492
```
493493

494+
### Restrictions
495+
496+
A property with an `init` accessor can only be declared in the primary
497+
declaration of a type.
498+
494499
## Source compatibility
495500

496501
`init` accessors are an additive capability with new syntax; there is no impact on existing source code.
497502

498503
## ABI compatibility
499504

500-
`init` accessors are only called from within a module, so they are not part of the module's ABI. In cases where a type's initializer is `@inlinable`, the body of an `init` accessor must also be inlinable.
505+
`init` accessors are an ABI-additive change; they are at most `internal` but can
506+
be ABI-public.
507+
Calling an `init` accessor from an `inlinable` type initializer requires that
508+
the `init` accessor is ABI-public.
501509

502510
## Implications on adoption
503511

0 commit comments

Comments
 (0)