can swift functions and closures conform to Hashable?

后端 未结 1 1215
难免孤独
难免孤独 2021-01-19 19:44

Suppose I want to have a Set of functions or closures. Here\'s how I would go about it:

typealias HandlerX = () -> ()
static var handlersX =         


        
1条回答
  •  有刺的猬
    2021-01-19 20:23

    Yes, this is a dead end. Hashable isn't really your problem; there's no way to decide whether two closures are Equal (which is a base requirement of Hashable).

    0 讨论(0)
提交回复
热议问题