Smalltalk-80, released by Xerox in 1980, used self
. Objective-C (early 1980s) layers Smalltalk features over C, so it uses self
too. Modula-3 (1988), Python (late 1980s), and Ruby (mid 1990s) also follow this tradition.
C++, also dating from the early 1980s, chose this
instead of self
. Since Java was designed to be familiar to C/C++ developers, it uses this
too.
Smalltalk uses the metaphor of objects sending messages to each other, so "self" just indicates that the object is sending a message to itself.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…