Skip to content

Conversation

@wilzbach
Copy link
Contributor

@wilzbach wilzbach commented Mar 16, 2018

In #6086 we prepared enforce to be a super set of enforceEx and thus allow a deprecation of it.

See also: https://dlang.org/changelog/2.079.0.html#std-exception-enforce

However, if enforce can't fully replace enforceEx, then it needs to stick around for at least one more release so that we can have a release where enforce can fully replace enforceEx.

This has happened, so we finally can start the deprecation rodeo.

The targetted deprecation version is 2.084 as it's marked as a legacy symbol in the docs for quite a while now.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@CyberShadow
Copy link
Member

What does errnoEnforce have to do with #6086, or anything? Do you mean enforceEx?


---
import std.exception : errnoEnforce;
errnoEnforce(enforce(errno != EINVAL, "Invalid environment variable name: '" ~ name ~ "'");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you meant here but this is not valid code.


---
import std.exception : enforce;
enforce(enforce(errno != EINVAL, "Invalid environment variable name: '" ~ name ~ "'");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

std/mmfile.d Outdated
// Adjust size
stat_t statbuf = void;
errnoEnforce(fstat(fd, &statbuf) == 0);
enforce(fstat(fd, &statbuf) == 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these changes are bogus.

errnoEnforce is useful in that it catches errno and prints a useful error message depending on its value.

@wilzbach wilzbach changed the title Push deprecation of std.exception.errnoEnforce Push deprecation of std.exception.enforceEx Mar 16, 2018
@wilzbach
Copy link
Contributor Author

errnoEnforce is useful in that it catches errno and prints a useful error message depending on its value.

Well alias errnoEnforce = enforce!ErrnoException (see #6289), but you are right I mixed things up (sorry - I should really go to bed earlier) and this PR should only be about triggering the overdue deprecation of enforceEx.

We could deprecate errnoEnforce as well, but that's a different discussion (-> #6289).

std/exception.d Outdated
--------------------
+/
//deprecated("Please use enforce instead")
deprecated("Use `enforce`. `enforceEx` will be removed with 2.084.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be 2.089 if we follow dlang/DIPs#108

@wilzbach
Copy link
Contributor Author

this should be 2.089 if we follow dlang/DIPs#108

Urgh that's very long, but it will be even longer if this doesn't get merged, so I changed the version ...

@wilzbach
Copy link
Contributor Author

The deprecation has already been approved in #6086

@wilzbach wilzbach merged commit 38b1ca0 into dlang:master Mar 21, 2018
@wilzbach wilzbach deleted the errnoEnforce branch March 21, 2018 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants