The Artima Developer Community
Sponsored Link

Programming in Scala Forum
p274 prepint v2: compile error?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
jeroen dijkmeijer

Posts: 6
Nickname: 53764
Registered: Jan, 2008

p274 prepint v2: compile error? Posted: Feb 24, 2008 12:07 PM
Reply to this message Reply
Advertisement
Not sure, it might be something I'm overlooking but I cant get "private
def format(e: Expr, enclPrec: Int): Element = e match {
case Var(name) =>
elem(name)
case Number(num) =>
def stripDot(s: String) =
if (s endsWith ".0") s.substring(0, s.length - 2) else s
elem(stripDot(num.toString))"
to compile.
Element.scala:
package layout
object Element {
def elem(contents: Array[String]): Element =
new ArrayElement(contents)

/Arihmetic.scala:35: error: type mismatch;
found : layout.Element
required: Element
elem(name)

changing the "Element" to Elemnent or using:
def format(e: Expr, enclPrec: Int): layout.Element = e match
makes it compile.
any ideas?

regards,
Jeroen.

Topic: Lazy evaluation / Futures? Previous Topic   Next Topic Topic: Error or Error on my part, page#70

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use