Marks a declared element as deprecated.
@Deprecate [ message ]
- Optional. A string literal to be displayd with the compiler warning.
If you develop a library that other programmers can use, you may find that a declared element, such as a method, is no longer relevant. Rather than just removing it and likely breaking user's code, you may want to deprecate the element for the moment and remove it later.
Library authors in most other languages find the process of deprecation frustrating because the users often miss the fact that something their code relies upon will be going away, since this can be expressed only in less than obvious ways – usually comments and documentation. ViviFire provides a means to explicitly mark deprecated elements such that any attempt to use it results in a compiler warning that cannot be missed.
Declared elements you may deprecate include the following:
- An entire Class
- An entire Enum or Flags, or just some elements
- An Event
- An entire Library module
- An Object
- A procedure (Function, Method, Property, Sub, Constructor, or Destructor)
- An entire Struct or just some elements
- A Trait
- A Unit or Base Unit
Any attempt to use a deprecated element will result in a compiler warning. If you supply a message along with the directive, it will be displayed immediately after the standard warning to provide additional information, such as an alternative to use in place of the deprecated element.
Library MyAPI @Deprecate Class foo End Class @Deprecate Use baz instead Method bar End Method Method baz End Method