Where is 'Any' declared/implemented in Swift 3 and onwards? -
any standard protocol (swift 2.2) ...?
prior swift 3.0, any described "the protocol types implicitly conform.", , implemented, in standard library, a typealias protocol<>:
typealias = protocol<>the protocol types implicitly conform.
from swift 3.0 onwards, usage , meaning seemingly unchanged, can no longer find—in fluidly changing language reference of swift—any explicit reference it.
- where
anydeclared/implemented in swift 3.0 onwards, , documented?
any has been removed standard library , keyword/builtin type
at time of implementation swift evolution proposal
for swift 3, any removed swift standard library , made keyword/builtin type. meaning , behaviour remains same.
citing evolution proposal above:
the existing
anytypealias, represents types conform 0 or more protocols (i.e. types), will become keyword. meaning not change.
citing updates in changelog.md the commit associated removing any typealias standard library:
the empty protocol composition,
anytype, defined beingprotocol<>. this has been removed standard library ,anykeyword same behaviour.
in another prior commit related implementing se-0095, can spot changes migrating any standard library , changing builtin keyword.
[se-0095] initial parsing implementation '
&' composition syntax commit defines ‘any’ keyword, implements parsing composing types infix ‘&’, , provides fixit convert ‘protocol<>’...
include/swift/ast/astcontext.h:// builtin type , simple types used frequently. ... + const cantype theanytype; /// 'any', empty protocol composition
include/swift/ast/knownidentifiers.def:... identifier(self) + identifier(any)
where keyword documented?
except various changelogs describing migration, documentation of any keyword can found in the language reference - lexical structure:
keywords , punctuation
...
- keywords used in expressions , types:
as,any,catch, ...
as as, subtly, in main grammar description of the language reference - types:
grammar of type
...
type -> metatype-type
type ->
anytype ->
self...
finally, before, (although being keyword/non-stdlib-type) any still described special type can use represent type @ all. citing the language guide - type casting:
type casting
any,anyobjectswift provides 2 special types working nonspecific types:
anycan represent instance of type @ all, including function types....
Comments
Post a Comment