I understand the this
(or self
or Me
) 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 uses self
but was wondering where and when (which programming language) the concept was first implemented?
Asked
Active
Viewed 1.1k times
54

Brian Tompsett - 汤莱恩
- 1,835
- 16
- 24

huijing
- 651
- 1
- 5
- 7
1 Answers
61
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;

Brian Tompsett - 汤莱恩
- 1,835
- 16
- 24
end..
andend--
bits? Do they constitute part of the syntax? – jogloran Mar 07 '20 at 21:31..of..Onto..Lists
and--of--Linker
and so on as comments -- but judging from the examples in the book chapter and elsewhere, I think that they are indeed optional comments (albeit not wholly freeform). – ruakh Mar 07 '20 at 22:22END
but may not contain any of the following:;
,END
,WHEN
,OTHERWISE
,ELSE
. Comments in the block body need to start with the keywordCOMMENT
. – njuffa Mar 08 '20 at 00:04