Hacker News new | past | comments | ask | show | jobs | submit login

There's a fun thing like this in Swift too! `Void` is an empty tuple, and has all of the related constraints (can't conform to protocols, being the most salient one). If you have a type that has to conform to, say, `Equatable` or `Codable` you should instead use `Never?` which you can conform to most protocols via throwing `fatalError` on an extension of `Never` to the protocol.

Anyway, I write basically this on my blog for a more thorough explanation: https://www.jackyoustra.com/blog/non-equatable-void




Lovely blog! If you would accept one suggestion, it would be to make it mobile friendly!


I'm glad to have a mobile reader :) I'll work on making it mobile friendly soon


Should be better now! Let me know if you have further concerns :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: