Skip to content

Commit fc8b9c9

Browse files
authored
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.
1 parent 4412463 commit fc8b9c9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

visions/embedded-swift.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ In order to achieve the goals listed above, Embedded **Swift** will impose limit
5757
* The standard library’s print() function in its current form will not be available, and an alternative will be provided instead.
5858
* 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).
5959
Examples:
60-
```
60+
```swift
6161
func foo<T>(t: T.Type) { ... `t` used in a downcast ... } // not OK
6262
extension UnsafeRawPointer {
6363
func load<T>(as type: T.Type) -> T { ... `type` unused ... } // OK
6464
}
6565
MyGenericClass<Int>.classFunc() // OK
6666
```
6767
* Existentials and dynamic downcasting of existentials will be disallowed. For example:
68-
```
69-
func foo(t: Any.Type) // not OK
68+
```swift
69+
func foo(t: Any.Type) {} // not OK
7070
var e: any Comparable = 42 // not OK
7171
var a: [Any] = [1, "string", 3.5] // not OK
7272
```
7373
* The types of thrown errors will be restricted in some manner, because thrown errors are of existential type `any Error` (which is disallowed by the prior item).
7474
* Classes will have restrictions, for example they cannot have non-final generic functions. For example:
75-
```
75+
```swift
7676
class MyClass<T> {
7777
func member() { } // OK
7878
func genericMember<U> { } // not OK
@@ -118,7 +118,7 @@ Building firmware using `-target arm64-apple-none` would highlight that we’re
118118

119119
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:
120120

121-
```
121+
```swift
122122
@available(embedded, unavailable, "not available in Embedded Swift mode")
123123
public func notAvailableOnEmbedded()
124124

0 commit comments

Comments
 (0)