scala - How is the "Any" class works with the "this" variable? -


please refer this, https://github.com/scala/scala/blob/v2.12.0-m1/src/library-aux/scala/any.scala

the abstract class uses "this" self reference equality test. far understand "this" not special scala. how "this" value handled in "any" ?

this special in scala. first of all, according lexical syntax section of language spec, this reserved keyword. see 6.5 , super part of spec precisely defines semantics of this keyword:

the expression this can appear in statement part of template or compound type. stands object being defined innermost template or compound type enclosing reference. if compound type, type of this compound type. if template of class or object definition simple name c, type of this same type of c.this.

so in case of any class, this reference actual object method of equality called upon.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -