Skip to content

Instantly share code, notes, and snippets.

Slava Pestov slavapestov

Block or report user

Report or block slavapestov

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 AnyEncodable.swift
struct AnyEncodable : Encodable {
var wrapped: Encodable
func encode(to encoder: Encoder) throws {
try wrapped.encode(to: encoder)
}
}
View init-puzzle.swift
struct S {
let x: Int
init(x: Int) { self.x = x }
// This is allowed
init(x2: Int) {
self.init(x: x2)
}
View puzzle.swift
// Example 1
protocol P {
func f() -> Self
}
extension P {
func f() -> Self {
return self
}
}
View keybase.md

Keybase proof

I hereby claim:

  • I am slavapestov on github.
  • I am spestov (https://keybase.io/spestov) on keybase.
  • I have a public key ASDtaF_IPmUGQ8saUB0otbOZbh8Y57SqiiSuq23Vlugttwo

To claim this, I am signing this object:

View fun-with-self.swift
func foo<T>(_: T) {
print("Self = \(T.self)")
}
protocol P {
func requirement()
}
extension P {
@slavapestov
slavapestov / foo.swift
Created Dec 17, 2015
Array of functions
View foo.swift
func foo() {
// Doesn't parse correctly
// let a = [() -> ()]()
let b = [(Int, Int)]()
let a: [() -> ()] = []
}
You can’t perform that action at this time.