Does Ada have the concept of reciever and self referencing (this, me)? David_Botton David@Botton.com Not really, because it's not necessary. Ada95 uses parameter notation instead of "distinguished reciever" syntax, so the object that is the recipient of the message is already identified explicitly.
For example, here's the implementation of the Push operation for a bounded stack:
procedure Push
(Item : in Item_Type;
On : in out Stack_Type) is
Stack : Stack_Type renames On; -- Stack is a nicer name inside the op
begin
pragma Assert (Stack.Depth < Max_Depth);
Stack.Depth := Stack.Depth + 1;
Stack.Items (Stack.Depth) := Item;
end Push;
The object "Stack" (same as "On") is the recipient of the Push message. You don't need a "this" to name it, because the stack object already has a name.
You can rename the components of the stack, so you don't have to explicitly select the attribute, ie
procedure Push
(Item : in Item_Type;
On : in out Stack_Type) is
Depth : Natural renames On.Depth;
Item : Item_Array renames On.Items;
begin
pragma Assert (Depth < Max_Depth);
Depth := Depth + 1;
Items (Depth) := Item;
end;
(Matthew Heaney)