Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

omochimetaru omochi

🏠
Working from home
  • japan
  • tokyo
Block or report user

Report or block omochi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View modify-coro.md

autoscale: true slidenumber: true

Swiftのmodifyアクセサとコルーチン

わいわいswiftc #17

@omochimetaru


Forum:

View MaybeEquatable2.swift
// see also https://gist.github.com/tarunon/85bdeccf8bc8f44b7b27d4974e0a843f
// user interface
public protocol MaybeEquatable {
func eraseToOpaqueEquatable() -> ErasedOpaqueEquatable
}
extension MaybeEquatable {
public func isEqual(to other: Any) -> Bool {
eraseToOpaqueEquatable().isEqual(to: other)
View MaybeEquatable.swift
// see also https://gist.github.com/tarunon/85bdeccf8bc8f44b7b27d4974e0a843f
public protocol MaybeEquatable {
func _isEqual(to other: Any) -> Bool
func __isEqual(to other: Any) -> Bool
}
extension MaybeEquatable {
public func __isEqual(to other: Any) -> Bool {
return false
View overload-score.md

slidenumber: true autoscale: true

Swiftのオーバーロード選択のスコア規則12種類

@omochimetaru

わいわいswiftc #16


View start-sil.md

slidenumber: true autoscale: true

SILを読もう

@omochimetaru

SwiftcKaigi #1


自己紹介

View swift-constexpr.md

slidenumber: true autoscale: true

Swiftのコンパイル時計算

わいわいswiftc #12

omochimetaru


コンパイル時計算

View memory-layout.swift
import Foundation
func dumpMemory(_ p: UnsafeRawPointer, _ size: Int) {
let addr = unsafeBitCast(p, to: UInt64.self)
var p = p.bindMemory(to: UInt8.self, capacity: size)
for i in 0..<size {
if i % 8 == 0 {
if i != 0 {
print()
}
View MessageError.swift
import Foundation
public struct MessageError: LocalizedError, CustomStringConvertible {
public var message: String
public init(_ message: String) {
self.message = message
}
public var description: String { message }
View dynamicReplacement.swift
// a.swift
public dynamic func f() {
print("original")
}
// b.swift
import a
@_dynamicReplacement(for: f())
public func f_b() {
View swift-new-rethrows.swift
import Foundation
protocol Iterator {
associatedtype Element
associatedtype Failure: Error
func _next() throws -> Element?
}
extension Iterator {
func next() throws -> Element? { try _next() }
You can’t perform that action at this time.