2024/9/25
laprasdrum.icon 体調崩しやすい気候
/icons/hr.icon
Sequoiaの月1スクリーン録画アクセス権リマインダーをオフにする
まだ遭遇してはいないがそういう現象があるらしい。
それを抑制するソフトを開発したとのこと。
HEX code(String)をColor型に変換したり、0 or 1をBoolとして解釈したいとき、またはJSON以外にもCSV/TSVなど構造化ドキュメントを構造化されたモデルに変換するときに使える。
Benchmarkの結果も悪くなさそう。
Swift MacroベースのMockolo。
ビルド時間やランタイムパフォーマンスが気になる。
Swift 6 updates
typed throwは一般的な throws は throws(any Error) と同義であり、throwsなしは throws(Never) と同義になる。
Genericsも使える。
Typed throws can also be used in generic functions to propagate error types from parameters, in a manner that is more precise than rethrows. For example, the Sequence.map method can propagate the thrown error type from its closure parameter, indicating that it only throws the same type of errors as the closure:
code:sample.swift
extension Sequence {
func map<T, E>(_ body: (Element) throws(E) -> T) throws(E) -> T { // ...
}
}
When given a closure that throws ParseError, map will throw ParseError. When given a non-throwing closure, E is inferred to Never and map will not throw.
(U)Int128も導入されるらしい。
BigIntはどうなるのかと思ったが、そもそもメンテが怪しい状況になってる。
広く使える(一般的ではない)Int128で置き換え、BigIntをSwiftがターゲットとするPFのABIとして用途が確定できたらBigIntに(内部的に)移行予定らしい。
Clang and GCC have historically exposed the extension types __uint128_t and __int128_t on 64b platforms only. These types basically behave like C builtin integer types--their size and alignment are 16B.
The C23 standard introduces _BitInt(N) as a means to spell arbitrary-width integer types, but these still have some warts. In particular, _BitInt(128) as implemented in clang has 8B alignment on x86_64 and arm64. For arm64, this is clearly a bug; the AAPCS specifies that it should have 16B alignment. For x86_64, the situation is less clear. The x86_64 psABI document specifies that it should have 8B alignment, but the authors of the proposal that added the feature tell me that it should be 16B aligned and that they are attempting to change the psABI.
We would like to be layout-compatible with _BitInt(128) on all platforms, but given the currently-murky state of the layout of those types, it makes the most sense to guarantee compatibility with the widely-used but non- standard __(u)int128_t and find mechanisms to make _BitInt(128) work once its ABI has been finalized on Swift's targeted platforms.
@DebugDescription はlldb上のデバッグを更に便利にしてくれる。
code:sample.swift
@DebugDescription
struct Organization: CustomDebugStringConvertible {
var id: String
var name: String
var manager: Person
// ... and more
var debugDescription: String {
}
}
code:output.sh
(lldb) p myOrg
(Organization) myOrg = "#100 Worldwide Travel [Jonathan Swift]"
Attached Macro
他のMacroも調べておく。知らないことが多い。
StaffEng
まだ全部読めてないので読む。