You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable syntax highlighting in embedded-swift.md (#2199)
* Enable syntax highlighting in `embedded-swift.md`
This change specifies language in Markdown code blocks to enable syntax highlighting in this vision document.
* Fix syntax HL parsing issue in `embedded-swift.md`
This made the existentials code block not render correctly.
Copy file name to clipboardExpand all lines: visions/embedded-swift.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,22 +57,22 @@ In order to achieve the goals listed above, Embedded **Swift** will impose limit
57
57
* The standard library’s print() function in its current form will not be available, and an alternative will be provided instead.
58
58
* Metatypes will be restricted in some way, and code patterns where a metatype value is actually needed at runtime will be disallowed (but at a minimum using a metatype function argument as a type hint will be allowed, as well as calling class methods and initializers on concrete types).
59
59
Examples:
60
-
```
60
+
```swift
61
61
funcfoo<T>(t: T.Type) { ... `t` used in a downcast ... } // not OK
62
62
extensionUnsafeRawPointer {
63
63
funcload<T>(astype: T.Type) -> T { ... `type` unused ... } // OK
64
64
}
65
65
MyGenericClass<Int>.classFunc() // OK
66
66
```
67
67
* Existentials and dynamic downcasting of existentials will be disallowed. For example:
68
-
```
69
-
func foo(t: Any.Type) // not OK
68
+
```swift
69
+
funcfoo(t: Any.Type) {} // not OK
70
70
var e: anyComparable=42// not OK
71
71
var a: [Any] = [1, "string", 3.5] // not OK
72
72
```
73
73
* The types of thrown errors will be restricted in some manner, because thrown errors are of existential type `anyError` (which is disallowed by the prior item).
74
74
* Classes will have restrictions, for example they cannot have non-final generic functions. For example:
75
-
```
75
+
```swift
76
76
class MyClass<T> {
77
77
funcmember() { } // OK
78
78
funcgenericMember<U> { } // not OK
@@ -118,7 +118,7 @@ Building firmware using `-target arm64-apple-none` would highlight that we’re
118
118
119
119
To support writing code that’s compiled under both regular Swift and also Embedded Swift, we should provide facilities to manage availability of APIs and conditional compilation of code. The concrete syntax for that is subject to discussion, the following snippet is presented only as a straw-man proposal:
120
120
121
-
```
121
+
```swift
122
122
@available(embedded, unavailable, "not available in Embedded Swift mode")
0 commit comments