Avatar
Still missing is casting from existential to concrete type (the only we will initially support) and a bigger set of types (e.g foreign types).
12:26 AM
Embedded Swift で Existential を有効化するモードが実装されている
12:28 AM
/// The embedded swift_allocBox version is different to the standad one in that /// we want to avoid building metadata for the box type. Instead we store the /// metadata of the contained type in the heap object. To make this work when /// destroying the box the release needs to be special i.e `swift_releaseBox`. /// It does not call the the heap object metadata's destroy function. Rather, it /// knows that the allocBox's metadata is the contained objects and calls an /// appropriate implementation: `_swift_embedded_invoke_box_destroy`. /// Therefore, one cannot not use `swift_release` but rather must use /// `swift_releaseBox` to implement the "release" function of a box object.
12:28 AM
通常、alloc box は その box 専用の metatype を生成するけど、
12:28 AM
embedded existential ではその代わりに中身の型の metatype を持って、
12:29 AM
box を release するときに、そのモードを考慮するようにランタイム関数を拡張するっぽい
12:30 AM
つまりオーバーヘッドを減らしたから許容できるってことなんだろうか それなら標準 Swift にも採用するべきな気がするが、box metatype が無いと困る場合もあるんだろうか・・・
12:31 AM
https://www.swift.org/blog/embedded-swift-improvements-coming-in-swift-6.3/ ブログも出たし、ownershipも進んでるし、なんだか色々やっている
Embedded Swift is a subset of Swift that’s designed for low resource usage, making it capable of running on constrained environments like microcontrollers. Using a special compilation mode, Embedded Swift produces significantly smaller binaries than regular Swift. While a subset of the full language, the vast majority of the Swift language wor...