In some programming languages, it is possible to mark functions as deprecated or obsolete and then it can't be used or should be used with caution. Sometimes it even results in a warning message somewhere.
Is it possible in the Delphi Programming Language to mark a procedure as deprecated? How does it work if it is possible?
Delphi has a deprecated
hinting directive 1:
Hinting Directives
The 'hint' directives
platform
,deprecated
, andlibrary
may be appended to any declaration. These directives will produce warnings at compile time. Hint directives can be applied to type declarations, variable declarations, class, interface, and structure declarations, field declarations within classes or records, procedure, function, and method declarations, and unit declarations....
... Use
platform
to mark items that are specific to a particular operating environment (such as Windows),deprecated
to indicate that an item is obsolete or supported only for backward compatibility, andlibrary
to flag dependencies on a particular library or component framework....
For example:
procedure SomeOldRoutine; deprecated 'This is old use SomeNewRoutine instead';
1: Note that Delphi's documentation does not describe the ability to include a user-defined warning message on deprecated
, but it is actually supported since Delphi 2009 (deprecated
itself was introduced in Delphi 6).