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 any declared/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 any typealias, 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, any type, defined being protocol<>. this has been removed standard library , any keyword 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 -> any

type -> 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 , anyobject

swift provides 2 special types working nonspecific types:

  • any can represent instance of type @ all, including function types.

...


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -