The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Error in example in the book.. and a Scala question

2 replies on 1 page. Most recent reply: Sep 1, 2008 10:34 AM by Alan Mortensen

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 2 replies on 1 page
Alan Mortensen

Posts: 5
Nickname: 57845
Registered: Aug, 2008

Error in example in the book.. and a Scala question Posted: Sep 1, 2008 12:20 AM
Reply to this message Reply
Advertisement
On page 279, section 13.4, there's a mention of deltaV, yet in Listing 13.12, there's no such name. I assume it means fuel.

My Scala question is, in that same Listing, you have to import Rocket.fuel. That seems awfully confusing to me. I couldn't figure out what the heck it meant until I read on to see what they were getting at. Now I wonder though.. isn't there a possible naming collision problem in Scala.. If the class has a subclass with the same name as a member of it's companion object then boom right? I know it's unlikely.. just curious. If the Rocket class had an internal class called launch and the Rocket object had a member called launch.. when you imported Rocket.launch which would you get? I know with naming conventions this shouldn't happen.. but that seems a little shaky..

Alan


Alan Mortensen

Posts: 5
Nickname: 57845
Registered: Aug, 2008

Re: Error in example in the book.. and a Scala question Posted: Sep 1, 2008 12:26 AM
Reply to this message Reply
Oops.. it should read..
If the class has an internal class, not subclass

Alan Mortensen

Posts: 5
Nickname: 57845
Registered: Aug, 2008

Re: Error in example in the book.. and a Scala question Posted: Sep 1, 2008 10:34 AM
Reply to this message Reply
I hate answering my own question.. but of course the inner class would not be accessible in the same context.. I was thinking of Java's static inner classes.. which in Scala make a lot less sense, since there are no static members.

Flat View: This topic has 2 replies on 1 page
Topic: Error in a listing in Chapter 15.. Previous Topic   Next Topic Topic: Payment without credit card

Sponsored Links



Google
  Web Artima.com   

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