News for hackers. Stuff that matters.
Re:The Python Paradox by Nullabillity on Friday January 27, 2023 @06:41PM (#34553332)
Type arguments, union types, and a sound type system: pick any two.

For example, imagine the following in an imaginary version of Rust with union types:

    #[derive(PartialEq)]
    struct Option<T> {
        value: T | (),
    }
    impl<T> Option<T> {
        fn some(value: T) -> Self {
            Self { value }
        }
        fn none() -> Self {
            Self { value: () }
        }
        fn is_none(&self) -> bool {
            match self.value {
                _: () => true,
                _: T => false,
            }
        }
    }
What does `Option::some(()).is_none()` return? Is `Option::some(()) == Option::none()`?

There are no comments on this comment yet.