Why does Delphi complain about deprecating a setter method, but not other methods. I'm using XE3, and Delphi doesn't support deprecating a property, so I thought I would deprecate the setter method. But Delphi doesn't like that either. It is perfectly happy with the "Procedure Text;" as deprecated though???

Why does Delphi complain about deprecating a setter method, but not other methods. I'm using XE3, and Delphi doesn't support deprecating a property, so I thought I would deprecate the setter method. But Delphi doesn't like that either. It is perfectly happy with the "Procedure Text;" as deprecated though???

TtiIntegerListItem = class(TtiBaseObject)
private
FValue: Int64;
// fails to compile
procedure SetValue(const Value: Int64); deprecated 'The AValue property is deprecated. Please use the Value property instead.';
// this one is accepted though
procedure Text; deprecated 'use Value() instead';
public
constructor CreateCustom(AValue: Int64);
property AValue: Int64 Read FValue Write SetValue; // Delphi doesn't support deprecated here like FPC does.
property Value: Int64 Read FValue Write FValue;
end;

Comments

  1. Graeme Geldenhuys no it doesn't, at least in Tokyo.

    Does same work in FPC mode Delphi??

    ReplyDelete
  2. Ugochukwu Mmaduekwe wrote:
    > Does same work in FPC mode Delphi?

    Yes, the 'deprecated' keyword works in all FPC compiler modes as far as I know. I explicitly test {$mode delphi} before I wrote this reply. The FPC compiler does give a warning about using a deprecated property.

    ReplyDelete

Post a Comment