Around 52:40, the use of `sealed` without `permits` is really clean, but how/when does the compiler determine that `Sell` and `Buy` are the only two entities implementing `Trade`? Or if the compiler keeps track of everything that implements `Trade` whether `Trade` is sealed or not, does the `sealed` modifier just tell it to treat that set as complete, for the purposes of things like pattern matching?
I’m a simple man. I see a Venkat Subramaniam video, I click it.
I admire you a lot, always excited for your new videos
Around 52:40, the use of `sealed` without `permits` is really clean, but how/when does the compiler determine that `Sell` and `Buy` are the only two entities implementing `Trade`? Or if the compiler keeps track of everything that implements `Trade` whether `Trade` is sealed or not, does the `sealed` modifier just tell it to treat that set as complete, for the purposes of things like pattern matching?
If we define permitted subclasses in the same file as the sealed interface | class, then we can omit permits clause.