4 ms·
> add deprecation notices one thing that I think needs to be more common is that you should not write simply "this method is deprecated". You must always say
by petalmind 3y ago
> add deprecation notices
one thing that I think needs to be more common is that you should not write simply "this method is deprecated".
You must always say "...is deprecated *in favour of* FOO".
- berkes 3y agoyes! And it's one of the first things I'll add to the lib/framework/tools/utils if it doesn't exist: a mechanism to mark code deprecated. It should require a description, the item that should be called instead, and optionally a URL and optionally a time/version after which it will be considered an error instead of a warning. The deprecation should be configurable (through ENV vars, e.g. DEPRECATIONS=fail|warn) so that I can run a test-suite or some local dev env and have it blow up when it hits a deprecation. Useful for when working on them and to raise awareness. Such a method/macro/function/annotation isn't that hard in most languages: just a proxy calling the deprecated method with the arguments passed in and then formatting a message and logging or raising that.