I'm trying to encourage the use of "template" to describe class and trait definitions—distinct from the types those definitions imply. I think it had bad connotations in C++, but the word is perfect for describing what it represents: every gap must be filled in on instantiation.
Part of the goal is to establish a template as a subtly different thing from the type with the same name: it defines the implementation, whereas types don't distinguish between properties with the same types but different implementations.
-
-
The compiler currently calls templates "class types", for example when you are told you can only inherit from a class type. But a trait is also a "class type". I think the rule is clearer when types aren't even mentioned: simply put, a template can inherit from another template.
Show this thread -
http://scala.zone has a whole section on templates, and a different section on types. So far, it hasn't been too much of a problem deciding which of the two sections each lesson belongs in.
Show this thread
End of conversation
New conversation -
-
-
Difficult to explain, since most languages use one construct for both. The Familia paper https://dl.acm.org/doi/pdf/10.1145/3133894 … is one language that explicitly separates both notions as "object type" and "representation type". Is that what you are aiming at? Ocaml Signatures vs modules?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.