Is this bug known?

Is this bug known?

type
IX = interface
['{2F2B4306-3427-43C7-8D86-A3E300501281}']
procedure Test(NormalParam: boolean; DefaultParam: boolean = true);
end;

TX = class(TInterfacedObject, IX)
public
procedure Test(NormalParam: boolean);
end;

Even though the implementation does not match the interface the compiler does not issue any hint, warning or error.
IMO this should be an error.

Comments

  1. Finally behind a Delphi XE8 machine:

    [dcc32 Error] Project3.dpr(16): E2291 Missing implementation of interface method IX.Test

    ReplyDelete
  2. I've debugged the issue.
    I had an original interface in a dll. Without optional parameters. I then added optional parameters, fixed up all the downstream consequences and recompiled. The code ran and did not crash and due to a coincidence the changed behavior manifested itself.

    Turns out that if you make changes to an interface that resides in a dll you can get at the source file, but Delphi will not recompile it (which is obvious).
    I was not aware that this code was not actually in my project so was let astray by wrong assumptions (another reminder to always make a MCVE).

    ReplyDelete
  3. Johan Bontes This is why I favor static linking over dlls (or packages): even if the executable is slightly larger, you don't suffer from "dll hell". For instance, I always link SQlite3 within my exe, even if I have 10 exe built! The few KB/MB saved by using shared dll is not worth it with computers with GBs of RAM, and the advanced memory mapping features of modern OS.

    ReplyDelete

Post a Comment