The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Type alias

1 reply on 1 page. Most recent reply: Jun 24, 2016 3:57 AM by Bill Venners

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 1 reply on 1 page
Stephen Riley

Posts: 2
Nickname: 93973
Registered: Dec, 2014

Type alias Posted: Jun 23, 2016 8:15 PM
Reply to this message Reply
Advertisement
I am unclear as to what the statement, "AnyRef is an alias for java.lang.Object", implies.

if AnyRef is an alias of java.lang.Object, and AnyRef is a subclass of Any, what, if anything, describes the relationship between Any and java.lang.Object?

I am beginning to learn Scala without a background in Java, so I am invoking the international NEWBIE protection clause.


Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: Type alias Posted: Jun 24, 2016 3:57 AM
Reply to this message Reply
> I am unclear as to what the statement, "AnyRef is
> an alias for java.lang.Object", implies.
>
> if AnyRef is an alias of java.lang.Object,
> and AnyRef is a subclass of Any, what, if
> anything, describes the relationship between Any
> and java.lang.Object?
>
> I am beginning to learn Scala without a background in
> Java, so I am invoking the international NEWBIE protection
> clause.
>
Any is also erased to java.lang.Object. Any is a bit of compile-time fiction, aimed at eliminating the need for programmers to think about primitive types as different from objects, by making primitive type values appear as instances of classes.

Flat View: This topic has 1 reply on 1 page
Topic: PDF pages 448-449 Previous Topic   Next Topic Topic: 3rd edition plans?

Sponsored Links



Google
  Web Artima.com   

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