@@ -367,54 +367,6 @@ Local functions are subject to the same restrictions as the inlineable
367
367
functions containing them, as described above.
368
368
369
369
370
- Versioning Internal Declarations
371
- --------------------------------
372
-
373
- The initial discussion on versioning focused on ``public `` APIs, making sure
374
- that a client knows what features they can use when a specific version of a
375
- library is present. Inlineable functions have much the same constraints, except
376
- the inlineable function is the client and the entities being used may not be
377
- ``public ``.
378
-
379
- Adding a versioning annotation to an ``internal `` entity promises that the
380
- entity will be available at link time in the containing module's binary. This
381
- makes it safe to refer to such an entity from an inlineable function. If the
382
- entity is ever made ``public ``, its availability should not be changed; not
383
- only is it safe for new clients to rely on it, but *existing * clients require
384
- its presence as well.
385
-
386
- .. note ::
387
-
388
- Why isn't this a special form of ``public ``? Because we don't want it to
389
- imply everything that ``public `` does, such as requiring overrides to be
390
- ``public ``.
391
-
392
- Because a versioned class member may eventually be made ``public ``, it must be
393
- assumed that new overrides may eventually appear from outside the module unless
394
- the member is marked ``final `` or the class is not publicly subclassable.
395
-
396
- Non-public conformances are never considered versioned, even if both the
397
- conforming type and the protocol are versioned.
398
-
399
- Entities declared ``private `` may not be versioned; the mangled name of such an
400
- entity includes an identifier based on the containing file, which means moving
401
- the declaration to another file changes the entity's mangled name. This implies
402
- that a client would not be able to find the entity at run time if the source
403
- code is reorganized, which is unacceptable.
404
-
405
- .. note ::
406
-
407
- There are ways around this limitation, the most simple being that versioned
408
- ``private `` entities are subject to the same cross-file redeclaration rules
409
- as ``internal `` entities. However, this is a purely additive feature, so to
410
- keep things simple we'll stick with the basics.
411
-
412
- We could do away with the entire feature if we restricted inlineable functions
413
- and fixed-layout structs to only refer to public entities. However, this
414
- removes one of the primary reasons to make something inlineable: to allow
415
- efficient access to a type while still protecting its invariants.
416
-
417
-
418
370
Top-Level Variables and Constants
419
371
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
420
372
@@ -940,6 +892,54 @@ converging on a single common attribute, say ``@fixed``, ``@inline``, or
940
892
multiple kinds of flexibility, as in the description of classes above.
941
893
942
894
895
+ Versioning Internal Declarations
896
+ ================================
897
+
898
+ The initial discussion on versioning focused on ``public `` APIs, making sure
899
+ that a client knows what features they can use when a specific version of a
900
+ library is present. Inlineable functions have much the same constraints, except
901
+ the inlineable function is the client and the entities being used may not be
902
+ ``public ``.
903
+
904
+ Adding a versioning annotation to an ``internal `` entity promises that the
905
+ entity will be available at link time in the containing module's binary. This
906
+ makes it safe to refer to such an entity from an inlineable function. If the
907
+ entity is ever made ``public ``, its availability should not be changed; not
908
+ only is it safe for new clients to rely on it, but *existing * clients require
909
+ its presence as well.
910
+
911
+ .. note ::
912
+
913
+ Why isn't this a special form of ``public ``? Because we don't want it to
914
+ imply everything that ``public `` does, such as requiring overrides to be
915
+ ``public ``.
916
+
917
+ Because a versioned class member may eventually be made ``public ``, it must be
918
+ assumed that new overrides may eventually appear from outside the module unless
919
+ the member is marked ``final `` or the class is not publicly subclassable.
920
+
921
+ Non-public conformances are never considered versioned, even if both the
922
+ conforming type and the protocol are versioned.
923
+
924
+ Entities declared ``private `` may not be versioned; the mangled name of such an
925
+ entity includes an identifier based on the containing file, which means moving
926
+ the declaration to another file changes the entity's mangled name. This implies
927
+ that a client would not be able to find the entity at run time if the source
928
+ code is reorganized, which is unacceptable.
929
+
930
+ .. note ::
931
+
932
+ There are ways around this limitation, the most simple being that versioned
933
+ ``private `` entities are subject to the same cross-file redeclaration rules
934
+ as ``internal `` entities. However, this is a purely additive feature, so to
935
+ keep things simple we'll stick with the basics.
936
+
937
+ We could do away with the entire feature if we restricted inlineable functions
938
+ and fixed-layout structs to only refer to public entities. However, this
939
+ removes one of the primary reasons to make something inlineable: to allow
940
+ efficient access to a type while still protecting its invariants.
941
+
942
+
943
943
Optimization
944
944
============
945
945
0 commit comments