[comp.sys.mac.programmer] lsp object problem

es2q+@andrew.cmu.edu (Erik Warren Selberg) (12/31/89)

I'm having a problem with LSP using objects.  What I'm trying to do is pass a
method of an object as a procedure/function, and Lightspeed is choking on it
(says it needs a function/procedure name) .  I'm using code similar to the
following:

type
  TGuy=object(TObject)
    procedure DoMe;
  end;

procedure DoIt(procedure it);
begin
  it;
end;

procedure DoGuy(guy:TGuy);
begin
  DoIt(guy.DoMe);
end;

I've tried passing TGuy.DoMe, as well as some other things, but LSP all chokes.
Any ideas?

Erik

samalone@athena.mit.edu (Stuart A. Malone) (01/03/90)

es2q+@andrew.cmu.edu (Erik Warren Selberg) writes:

>I'm having a problem with LSP using objects.  What I'm trying to do is pass a
>method of an object as a procedure/function, and Lightspeed is choking on it
>(says it needs a function/procedure name).

Try this:

	procedure DoGuy(guy:TGuy)
	  procedure DoThisGuy;
	  begin
	    guy.DoMe;
	  end;
	begin
	  DoIt(DoThisGuy);
	end;

It's messy, but it works.

				--Stuart A. Malone
				samalone@athena.mit.edu