5 ms·
good idea, but it's stupid to put it in the standard library it should be built in
by Kukumber 4y ago
good idea, but it's stupid to put it in the standard library
it should be built in
- stephencanon 4y agoVery, very little of the swift surface language is not part of the standard library. "Basic" types like `Int` and operations like `==` are defined in the standard library, rather than built-in.
- Kukumber 4y agoThey are in the runtime, not in the standard library std lib means you'll have to import a module import Move move(a)
- favorited 4y agoYou are incorrect. Swift's standard library is named "Swift" – and it is automatically imported. You can refer to something in the standard library implicitly `let x = Array<Int>()` or by specifying the standard library's module `let x = Swift.Array<Swift.Int>()`.
- stephencanon 4y agoNo. The swift stdlib is the API that is available by default without any import statements (consisting of the Swift, _Concurrency, and _StringProcessing modules). The runtime is a separate library that programs do not explicitly interact with; calls into the runtime are implicitly generated by the compiler when necessary to perform tasks like allocation or retain/release.
- Kukumber 4y agoThanks for the information
- Someone 4y agoOne of the stated goals is which enforces this by causing the compiler to emit a diagnostic upon any uses that are after the move function, so they may say it will be part of the standard library, but the compiler will have to know what it does, just as a C compiler can assume what strlen (if #included from the right system header) does and inline it any way it wishes.