
Glossary 712
declarations and definitions is that definitions establish an implemen-
tation for the named entity, declarations do not.
define To define something in a Scala program is to give it a name and
an implementation. You can define classes, traits, singleton objects,
fields, methods, local functions, local variables, etc. Because defini-
tions always involve some kind of implementation, abstract members
are declared not defined.
direct subclass A class is a direct subclass of its direct superclass.
direct superclass The class from which a class or trait it is immediately de-
rived, the nearest class above it in its inheritance hierarchy. If a class
Parent is mentioned in a class Child’s optional extends clause, then
Parent is the direct superclass of Child. If a trait is mentioned in
Child’s extends clause, the trait’s direct superclass is the Child’s di-
rect superclass. If Child has no extends clause, then AnyRef is the
direct superclass of Child. If a class’s direct superclass takes type pa-
rameters, for example class Child extends Parent[String], the
direct superclass of Child is still Parent, not Parent[String]. On
the other hand, Parent[String] would be the direct supertype of
Child. See supertype for more discussion of the distinction between
class and type.
equality When used without qualification, equality is the relation between
values expressed by ‘==’. See also reference equality.
existential type An existential type includes references to type variables
that are unknown. For example, Array[T] forSome { type T } is
an existential type. It is an array of T, where T is some completely
unknown type. All that is assumed about T is that it exists at all. This
assumption is weak, but it means at least that an Array[T] forSome
{ type T } is indeed an array and not a banana.
expression Any bit of Scala code that yields a result. You can also say that
an expression evaluates to a result or results in a value.
filter An if followed by a boolean expression in a for expression. In
for(i <- 1 to 10; if i % 2 == 0), the filter is “if i % 2 == 0”.
The value to the right of the if is the filter expression.
Cover · Overview · Contents · Discuss · Suggest · Glossary · Index