3 Apr 2007 19:36
Re: + and List
martin odersky <odersky <at> gmail.com>
2007-04-03 17:36:18 GMT
2007-04-03 17:36:18 GMT
> > Well, I have no problem creating Lists. I just wanted to make sure I > understand what is actually going on when I say: > > val list = List(1, 2, 3) > > I've been scratching my head for a while, but just now found the > apply method on *object* List. I hadn't noticed object List in the > ScalaDocs before, just class List. > Yes, that's exactly it. List(1, 2, 3) is equivalent to List.apply(1, 2, 3). Case classes have nothing to do with it. Note that List is not a case class, :: and Nil are. As to `+' that's indeed treated as a special method in Java's string class. So ScalaDoc does not show it. It would be nice to change it so that it does, together with any methods that are added by implicits. Cheers -- Martin
RSS Feed