Aladdin - Scala Bugtracking
[#829] project: compiler priority: low category: missing feature
submitter assigned to status date submitted
Burak _ _ 2006-11-17 18:00:03.0
subject lazy initialization
code
// a use case for lazy initialization

// student writes recursive descent parser
// somehow decides to have first sets

class Parser {
  val firstA:List[Token] = firstB ::: firstC
  val firstB = List(LT)
  val firstC = List(LBRACK)

  def a = ...
  def b = ...
  def c = ...
}
what happened
suppose the order of the fields follows the order of the grammar. unfortunately, the current way to initialize f\
ields preserves the order, and thus this code will fail at runtime with a nullpointer exception
what expected lazy initialization? reordering? i only submit this "missing feature report" as a use and test case if one day we should implement it.
[back to overview]
Changes of this bug report