▲ | sunnyps 3 days ago | |
Would the interface nil example be clearer if checking for `nil` didn't use the `==` operator? For example, with a hypothetical `is` operator:
Of course, this means you have to precisely define the semantics of `is` and `==`:- `is` for interfaces checks both value and interface type. - `==` for interfaces uses only the value and not the interface type. - For structs/value, `is` and `==` are obvious since there's only a value to check. |