SelfType and MyType

Hallo,
In the paper "Scalable Component Abstractions", Odersky introduces the selftype construct for Scala,
and says its different from the MyType construct.Does anyone one have a link to a paper that compares the two constructs? A paper that provides in depth discription of selftype construct?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Possibly this...

http://portal.acm.org/citation.cfm?id=1640089.1640109

From my experience and hazy

Just in case you are looking for experience in addition to a paper:

From my hazy memory, Scala's self type can only be used inside the implementation of the class or trait to type "this". Self type can't leak outside of the class in a signature, and hence is only useful for expressing class implementation.

Actually, to be more accurate, self type is the "exact" type of this, which includes this's identity. Therefore, it wouldn't make any sense to use it to type any other object even if they had the same branded type as "this." So if you wanted to use self type to express a binary method, you couldn't (but type members work just as well for this).

Traditional self type doesn't include object identity. So the self type of a class would be the branded type of this (the type that doesn't include this's object identity), and you could use it to express binary methods.