Question:
Is there a way to do duck typing with Delphi 2007 (i.e. without generics and advanced Rtti features)?
Duck typing Re
Here's an idea that requires you create a type library.
Use OLE Automation types, and implement Dispatch Interfaces (dual COM objects).
Now you Now you can write whatever you want after that type, and we'll be finding out at runtime whether or not it works, or blows up. Welcome to dynamic typing.
procedure DoSomething(D:OleVariant);
begin
D.Quack; // Might work, might blow up.
end;
I consider it ugly, but others might not.