I understand the
this
(orself
orMe
) is used to refer to the current object, and that it is a feature of object-oriented programming languages. The earliest language I could find which has such a concept was Smalltalk, which usesself
but was wondering where and when (which programming language) the concept was first implemented?
Answer
Simula 67 is generally considered the first object-oriented language and predates Smalltalk by a number of years.
It also used the this
keyword for the same concept, which can be seen in this book chapter extract:
class Linker;
begin
ref(Linker) Next, Sex, Employment;
text ID;
procedure Add_to_List(LHead); name LHead; ref(Linker) LHead;
begin
Next :- LHead;
LHead :- this Linker
end..of..Add..to..List;
procedure Onto_Lists(Gender,Occupation);
name Gender,Occupation;
ref(Linker) Gender,Occupation;
begin
Sex :- Gender;
Employment :- Occupation;
Gender :- Occupation :- this Linker
end..of..Onto..Lists;
InImage;
ID :- Copy(SysIn.Image);
InImage;
end--of--Linker;
Attribution
Source : Link , Question Author : huijing , Answer Author : Brian Tompsett – 汤莱恩