4 ms·
I'm not sure why you think this is unsound. We check traits in isolation -- we ensure that methods you call are either defined in the trait or declared abstract
by jwatzman 13y ago
I'm not sure why you think this is unsound. We check traits in isolation -- we ensure that methods you call are either defined in the trait or declared abstract (and so must be defined in the including class). We also added "trait requirements" to the language, so you can say "the including class must implement this interface" ("require implements IFoo") and we'll know that in the type system too. This means that we can ensure traits are sound even in isolation, and that including classes are sound when they include the traits.
Feel free to play around with the type system in the interactive code editor on http://hacklang.org/ http://hacklang.org/.
- samth 13y agoFrom playing with the editor, it looks like it is sound. What I thought the quoted passage was saying was that consistency between a class and a trait used by the class was not checked. That's clearly not the case, though. I don't understand what the performance point is, though, since I don't think the copy-and-paste style would produce different answers. Finally, the online editor doesn't seem to honor // strict -- it doesn't produce an error when some methods aren't annotated.