- Java: What is the static type of
this
in a method
that overrides another?
[In any method, the static type of this
is the
class in which the method is defined. However, the static type
is rarely gets much attention. The dynamic type of
this
is usually more interesting, since all method
calls in Java are dynamically dispatched.]
- What are the advantages of making a member (method or variable)
static?
[Static members are per-class (not per-instance) memory, so if
all instances of a class can share a variable,
making that explicit by declaring it static and save some
memory. One of the aspects of static methods is that they're
dispatched statically, which is simpler to understand (and
imperceptibly faster in execution) than dynamic dispatching.
Static methods can also be called without instantiating the
class, e.g., the many static methods in class Math, package
java.lang.]
- What is call by name?
[Don't worry about it yet, since we haven't covered parameter
passing models in full. See notes on the course web under
General Concepts.]
- What is strong vs. weak typing?
[In this course, "strongly typed" == "type safe" and "weakly
typed" == "not type safe." See next question.]
- Java and Miranda... Which are statically/dynamically typed, and
which are type safe?
[Java is statically typed with some special exceptions with
casting. Although Miranda doesn't require explicit type
declarations, with its type inference, Miranda is also
statically typed. Both languages are type safe, in the sense
that they don't allow taking a value of one type and forcing it
to be interpreted as any other type the programmer wants. (In
contrast, in C or C++, you can take an int
and cast it to a
char *
or any other type, for that matter.)]
- What is lazy evaluation?
[not evaluating an expression until the very last moment, i.e.,
until it is absolutely impossible to proceed without evaluating
it; see also: FOLDOC definition]
- What is ZF notation?
[the fancy, academic name for list comprehensions]
- Smalltalk: What's up with := and the <- character?
[They're equivalent operators and both perform assignment. <- is a
special character, filed out as an underscore ('_'), and := is the
version of the operator that uses standard characters.
Smalltalk is not on the mid-term, FYI.]