[SE-0193] Cross-module
inlining and specialization
• Swift ݱࡏՄҎᯩଶฤᩄྃɻ
• ෆաݱࡏ೭ؒᔒ༗࠷ՂԽɼرະိՄҎҰى၏
࠷ՂԽɻ
Slide 9
Slide 9 text
[SE-0193] Cross-module
inlining and specialization
// library
public func mul(_ a:Int, _ b:Int) -> Int {
return a * b
}
// user
func mul(_ a:Int,_ b:Int,_ c:Int) -> Int {
return mul(mul(a,b),c)
}
• ҼҝੋࡏෆಉతॴҎᔒ㭎๏࠷ՂԽɼೳরզ၇
ሜతฤᩄ
Slide 10
Slide 10 text
[SE-0193] Cross-module
inlining and specialization
// library
@_inlineable
public func mul(_ a:Int, _ b:Int) -> Int {
return a * b
}
// user
func mul(_ a:Int,_ b:Int,_ c:Int) -> Int {
return mul(mul(a,b),c) // a * b * c
}
• Ճྃ @inlineable ೭ޙɼฤᩄثबՄҎ፤౸ mul తݪ
࢝ᛰိ၏࠷ՂԽ
Slide 11
Slide 11 text
[SE-0193] Cross-module
inlining and specialization
@usableFromInline
func add(_ a:Int, _ b: Int) -> Int {
return a + b
}
@inlineable
public func mul(_ a:Int, _ b:Int) -> Int {
var res = 0
for _ in 0..
Slide 12
Slide 12 text
[SE-0143] (मվ) Conditional
Conformance
• Conditional Conformance Ҹڐ generic ࡏ ᑍ݅ූ߹
తܗگԼ९॥ࠣ protocolɻ
• Ꭿྫိ㘸ɼ
let a = [[1]]
let b = [[2]]
a == b
• ࡏ4.0 ။ᔒ㭎๏ compileɼࡏ 4.1 ੋ false
Community
• Swift for TensorFlow
• https://www.youtube.com/watch?
list=PLQY2H8rRoyvxjVx3zfw4vA4cvlKogyLNN&v=Y
ze693W4MaU
Slide 15
Slide 15 text
Community
• LOLCode literal for swift
https://github.com/apple/swift/pull/15664/
files#diff-8ec25bd1041bc5e833d0451725039b7cR
1
https://forums.swift.org/t/pitch-lolcode/11565
• https://zh.wikipedia.org/zh-tw/LOLCODE
Slide 16
Slide 16 text
Community
• objc2swift
• https://github.com/yahoojapan/objc2swift
• objectivec2swift
• https://objectivec2swift.com/#/home