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 ofthis
compound type. if template of class or object definition simple namec
, type ofthis
same type ofc.this
.
so in case of any
class, this
reference actual object method of equality called upon.
Comments
Post a Comment