-
Notifications
You must be signed in to change notification settings - Fork 254
Add Embedded Swift update blog post #1236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dempseyatgithub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a few wording suggestions, but overall this is a very nice, informative post!
I think the added introduction paragraphs do an excellent job of giving readers a lot of information in a clear, concise way, with links to explore more. This will be useful both for folks new to Embedded Swift and those who are already using it.
|
|
||
| [Embedded Swift](https://www.swift.org/get-started/embedded/) is a subset of Swift that can be used to develop bare-metal, embedded, and standalone programs for a variety of hardware platforms and environments. Embedded Swift is currently an experimental feature that uses a special compilation mode to produce significantly smaller binaries than regular Swift, using techniques described in the [Embedded Swift vision document](https://github.com/swiftlang/swift-evolution/blob/main/visions/embedded-swift.md). | ||
|
|
||
| Embedded Swift is evolving rapidly. This post describes a number of improvements we’ve made in the last few months, covering everything from improved C interoperability to better debugging and steps toward a complete linkage model for Embedded Swift. These features and bug fixes will be available in the upcoming [Swift 6.3](https://forums.swift.org/t/swift-6-3-release-process/82843) release, but you can try them out today with a [Swift development snapshot](https://www.swift.org/install/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in 'a number of improvements we've made in the last few months'.
It's unclear who 'we' are.
Is it only the authors Doug and Rauhul?
Maybe use 'improvements the team has made'
or
'improvement the community has made'
or
'improvements made'
The lead sentence already uses the passive voice withouts citing exactly who is making Embedded Swift evolve rapidly.
|
|
||
| ### Embedded restriction diagnostics | ||
|
|
||
| There is a new opt-in set of warnings in the [EmbeddedRestrictions](https://docs.swift.org/compiler/documentation/diagnostics/embedded-restrictions) diagnostic group that diagnoses language constructs that aren’t available in Embedded Swift, such as uses of untyped throws or calling generic functions on existential values (follow the earlier link for more information). These diagnostics are enabled by default when building Embedded Swift, and can also be enabled in non-Embedded Swift using the compiler flag `-Wwarning EmbeddedRestrictions`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The '(follow the earlier link for more information).' seems a little awkward.
Possibly move the link to the parenthetical and update it to something like:
'(See documentation for full details.)'
|
|
||
| ### Swift MMIO 0.1.x | ||
|
|
||
| The [0.1.x release](https://github.com/apple/swift-mmio/releases/tag/0.1.0) of Swift MMIO brings a bunch of bug fixes and quality-of-life improvements, plus brand new comprehensive [documentation](https://swiftpackageindex.com/apple/swift-mmio/0.1.1/documentation/mmio) on the Swift Package Index. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly spell out what MMIO means the first time it is used, or add a phrase that makes it clear:
'The 0.1.x release of Swift MMIO, a package for memory mapped I/O, brings...'
'brings a bunch of bug fixes' feels more colloquial than the tone of the rest of the post.
Maybe 'brings many bug fixes' or 'includes many bug fixes'.
'brand new comprehensive documentation'
implies there was old comprehensive documentation
Maybe 'newly written comprehensive documentation'
heckj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some wording suggestions, all inlined - mostly reducing passive voice and using more direct, second-person phrasing in some of the content. For links to external documentation at Swift Package Index, I tweaked up the URLS to use the "latest release" form to make the links have a little better "lifetime" as this post ages.
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
|
|
||
| ### Embedded restriction diagnostics | ||
|
|
||
| There is a new opt-in set of warnings in the [EmbeddedRestrictions](https://docs.swift.org/compiler/documentation/diagnostics/embedded-restrictions) diagnostic group that diagnoses language constructs that aren’t available in Embedded Swift, such as uses of untyped throws or calling generic functions on existential values (follow the earlier link for more information). These diagnostics are enabled by default when building Embedded Swift, and can also be enabled in non-Embedded Swift using the compiler flag `-Wwarning EmbeddedRestrictions`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| There is a new opt-in set of warnings in the [EmbeddedRestrictions](https://docs.swift.org/compiler/documentation/diagnostics/embedded-restrictions) diagnostic group that diagnoses language constructs that aren’t available in Embedded Swift, such as uses of untyped throws or calling generic functions on existential values (follow the earlier link for more information). These diagnostics are enabled by default when building Embedded Swift, and can also be enabled in non-Embedded Swift using the compiler flag `-Wwarning EmbeddedRestrictions`. | |
| There is a new opt-in set of warnings in the [EmbeddedRestrictions](https://docs.swift.org/compiler/documentation/diagnostics/embedded-restrictions) diagnostic group that diagnoses language constructs that aren’t available in Embedded Swift, such as uses of untyped throws or calling generic functions on existential values. | |
| These diagnostics are enabled by default when building Embedded Swift, and can also be enabled in non-Embedded Swift using the compiler flag `-Wwarning EmbeddedRestrictions`. | |
| Read the full details at [EmbeddedRestrictions](https://docs.swift.org/compiler/documentation/diagnostics/embedded-restrictions). |
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Joseph Heck <j_heck@apple.com> Co-authored-by: Mishal Shah <shahmishal@users.noreply.github.com>
|
|
||
| [Embedded Swift](/get-started/embedded/) is a subset of Swift that can be used to develop bare-metal, embedded, and standalone programs for a variety of hardware platforms and environments. Embedded Swift is currently an experimental feature that uses a special compilation mode to produce significantly smaller binaries than regular Swift, using techniques described in the [Embedded Swift vision document](https://github.com/swiftlang/swift-evolution/blob/main/visions/embedded-swift.md). | ||
|
|
||
| Embedded Swift is evolving rapidly. This post describes a number of improvements made in the last few months, covering everything from improved C interoperability to better debugging and steps toward a complete linkage model for Embedded Swift. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Embedded Swift is evolving rapidly. This post describes a number of improvements made in the last few months, covering everything from improved C interoperability to better debugging and steps toward a complete linkage model for Embedded Swift. | |
| Embedded Swift is evolving rapidly. This post describes a number of improvements made in the last few months, covering everything from improved C interoperability to better debugging, and steps toward a complete linkage model for Embedded Swift. |
|
|
||
| ### Printing floating point numbers | ||
|
|
||
| Previously, the `description` and `debugDescription` properties for floating-point types (`Float`, `Double`, etc.) were not available in the Embedded Swift standard library. With a new [all-Swift implementation](https://github.com/swiftlang/swift/pull/84826), you can use this with Embedded Swift. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all-Swift -> "pure Swift" or "Swift-only"
can use this -> can now use these
|
|
||
| ### Embedded restriction diagnostics | ||
|
|
||
| There is a new opt-in set of warnings in the [EmbeddedRestrictions](https://docs.swift.org/compiler/documentation/diagnostics/embedded-restrictions) diagnostic group that diagnoses language constructs that aren’t available in Embedded Swift, such as uses of untyped throws or calling generic functions on existential values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| There is a new opt-in set of warnings in the [EmbeddedRestrictions](https://docs.swift.org/compiler/documentation/diagnostics/embedded-restrictions) diagnostic group that diagnoses language constructs that aren’t available in Embedded Swift, such as uses of untyped throws or calling generic functions on existential values. | |
| There is a new opt-in set of warnings in the [EmbeddedRestrictions](https://docs.swift.org/compiler/documentation/diagnostics/embedded-restrictions) diagnostic group that diagnoses language constructs that aren’t available in Embedded Swift, such as use of untyped throws or calling generic functions on existential values. |
|
|
||
| LLDB needs access to type layout information so it can display variables. Since Embedded Swift doesn't contain reflection metadata, the Swift compiler emits all the type layout information as DWARF debug info. | ||
| There have been several improvements to the Swift compiler's debug info output, such as support for type declarations nested inside an extension. | ||
| At the same time LLDB added support for nested generic type aliases in Embedded Swift. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| At the same time LLDB added support for nested generic type aliases in Embedded Swift. | |
| At the same time, LLDB added support for nested generic type aliases in Embedded Swift. |
|
|
||
| However this back trace would often be missing one or more frames before the start of the exception frame (`UsageFault_Handler` above). | ||
|
|
||
| Now, LLDB is able to walk back through exception frames into the standard program frames and produce a backtrace that contains the missing frame(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Now, LLDB is able to walk back through exception frames into the standard program frames and produce a backtrace that contains the missing frame(s). | |
| Now, LLDB is able to walk back through exception frames into the standard program frames and produce a backtrace that contains the missing frames. |
|
|
||
| ### Progress on the Embedded Swift linkage model | ||
|
|
||
| Embedded Swift uses a different compilation model from regular Swift that delays code generation to later in the compilation process. This compilation model has not been fully defined and has various practical problems. One such issue involves duplicate symbols: if you have four Embedded Swift libraries whose dependencies formed a diamond, like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Embedded Swift uses a different compilation model from regular Swift that delays code generation to later in the compilation process. This compilation model has not been fully defined and has various practical problems. One such issue involves duplicate symbols: if you have four Embedded Swift libraries whose dependencies formed a diamond, like this: | |
| Embedded Swift uses a different compilation model from regular Swift, that delays code generation to later in the compilation process. This compilation model has not been fully defined and has various practical problems. One such issue involves duplicate symbols - if you have four Embedded Swift libraries whose dependencies form a diamond, like this: |
| D | ||
| ``` | ||
|
|
||
| Then symbols from `A` that are used in both `B` and `C` would cause duplicate definition errors when linking both into `D`. The Swift compiler now emits symbols from imported modules using weak definitions, so the linker can de-duplicate them. This eliminates the need for flags like `-mergeable-symbols` and `-emit-empty-object-file` that provided partial workarounds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Then symbols from `A` that are used in both `B` and `C` would cause duplicate definition errors when linking both into `D`. The Swift compiler now emits symbols from imported modules using weak definitions, so the linker can de-duplicate them. This eliminates the need for flags like `-mergeable-symbols` and `-emit-empty-object-file` that provided partial workarounds. | |
| Then, symbols from `A` that are used in both `B` and `C` would cause duplicate definition errors when linking both into `D`. The Swift compiler now emits symbols from imported modules using weak definitions, so the linker can de-duplicate them. This eliminates the need for flags like `-mergeable-symbols` and `-emit-empty-object-file` that provided partial workarounds. |
|
|
||
| Then symbols from `A` that are used in both `B` and `C` would cause duplicate definition errors when linking both into `D`. The Swift compiler now emits symbols from imported modules using weak definitions, so the linker can de-duplicate them. This eliminates the need for flags like `-mergeable-symbols` and `-emit-empty-object-file` that provided partial workarounds. | ||
|
|
||
| Another step along to path to formalizing the Embedded Swift linkage model is [SE-0497](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0497-definition-visibility.md), which defines a new `@export` attribute that controls how a function is visible to clients. The spelling `@export(implementation)` makes the implementation available for clients to emit, specialize, or inline, subsuming the longstanding but unofficial `@_alwaysEmitIntoClient` attribute. The spelling `@export(interface)` ensures that only the interface and *not* the definition of the function is made available to clients by emitting a callable symbol, allowing library developers to fully hide the implementation of a function even in Embedded Swift. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Another step along to path to formalizing the Embedded Swift linkage model is [SE-0497](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0497-definition-visibility.md), which defines a new `@export` attribute that controls how a function is visible to clients. The spelling `@export(implementation)` makes the implementation available for clients to emit, specialize, or inline, subsuming the longstanding but unofficial `@_alwaysEmitIntoClient` attribute. The spelling `@export(interface)` ensures that only the interface and *not* the definition of the function is made available to clients by emitting a callable symbol, allowing library developers to fully hide the implementation of a function even in Embedded Swift. | |
| Another step along the path to formalizing the Embedded Swift linkage model is [SE-0497](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0497-definition-visibility.md), which defines a new `@export` attribute that controls how a function is visible to clients. The spelling `@export(implementation)` makes the implementation available for clients to emit, specialize, or inline, subsuming the longstanding but unofficial `@_alwaysEmitIntoClient` attribute. The spelling `@export(interface)` ensures that only the interface and *not* the definition of the function is made available to clients by emitting a callable symbol, allowing library developers to fully hide the implementation of a function even in Embedded Swift. |
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
_posts/2025-11-17-embedded-swift-improvements-coming-in-swift-6.3.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Dave Lester <18080+davelester@users.noreply.github.com>
No description provided.