原文:Is it possible to define a constructor-local variable in Scala?
The following code is taken from Programming in Scala book by Martin Odersky et al. which defines a rational type: class Rational(n: Int, d: Int) { require(d != 0) private val g = gcd(n.abs, d....