Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

Deprecated attribute consistency

Version 1
Created 2016-01-13
StatusDraft
Last modified --
Author Brian Schott

Abstract

Currently the version of “deprecated” that takes a string literal describing the deprecation can be used as an attribute, but not a storage class. The version that does not take a description can be used as both. This DIP will make the use of the “deprecated” attribute/storage class more consistent.

Rationale

It is confusing to the users of D that the following code compiles:

deprecated i = 10;

but the following code does not:

deprecated("This field will be removed in March 2017") i = 10;

Grammar Change

“deprecated” will be removed from the “StorageClass” grammar and replaced with “DeprecatedAttribute”.

Backwards Compatability

Because this change will allow previously invalid code to be valid, no old code will need to be upgraded.

This document has been placed in the Public Domain.