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.
-
-
Show this thread
-
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 -
-
-
For clarity, what are the bad connotations of template wrt C++?
-
I never wrote a useful line of C++, but I used to hear templates described as "too complex for most people to understand" and Scala's generics described as a "sane version of templates". I've no idea how true any of that is, though.
- Show replies
New conversation -
-
-
Isn't the compiler using "template" as the "shared" AST pieces of classes, traits, etc. or am I misremembering that?
-
I'm not sure, I never looked. But I know you'll remember very clearly that objects are called "Modules" in the compiler, so there's not always consistent naming inside and out...
- Show replies
New conversation -
-
-
I guess u mean "templates" to denote the commonality in definitions while the "types" will define the variabilities. This exact theme has been described wonderfully by Jim Coplien in his book Multi Paradigm Design in C++. It’s a wonderful read though based on C++.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
In Scala's docs classes are called "blueprints", maybe that might be an alternative for the overloaded (across PLs) "template" term?https://docs.scala-lang.org/tour/classes.html …
-
I'm not so fond of "blueprint"... more than anything, I want to get across the idea that there are gaps which need to be filled in to construct an instance: constructor parameters, type parameters, type members, abstract methods, etc.
End of conversation
New conversation -
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.