When I played with symbol resolution, I constructed a "beautiful" method declaration:

When I played with symbol resolution, I constructed a "beautiful" method declaration:
type
  comp = class
  private
    function comp(comp: comp): comp;
  end;

function comp.comp(comp: comp): comp;
begin
  comp := comp;
end;

Wow, It compiles! :D

Comments

  1. Panagiotis Drivilas yes. It does make sense only in symbol resolution.

    ReplyDelete
  2. So when the symbol comp is referenced from inside the method, is it referring to the result or the parameter? If it's the result, how would one reference the parameter, or is it impossible because of the method name?

    ReplyDelete
  3. Anthony Frazier It refers to the parameter within the scope. however, if you use comp := comp.comp(comp);  the third comp symbol refers to the method, of course.

    ReplyDelete

Post a Comment