Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring vibe.d's enforce closer to std.exception.enforce #839

Merged
merged 1 commit into from
Sep 24, 2014

Conversation

Geod24
Copy link
Contributor

@Geod24 Geod24 commented Sep 23, 2014

(1) Use of lazy const(char)[] instead of string -> No more eager format() call;
(2) Return the value computed;

There are some low-hanging fruit for (2), like here (P.R for them to come soon)

@s-ludwig
Copy link
Member

Thanks, makes sense. The only thing that I'm not sure about is using const(char)[]. Does the original enforce have to .idup the message, too?

@Geod24
Copy link
Contributor Author

Geod24 commented Sep 23, 2014

@s-ludwig
Copy link
Member

That's ugly :(

In that case I'd propose to make a second overload that takes a lazy string, because in all cases that I know of the input string is already immutable.

@Geod24 Geod24 force-pushed the enforce-returns branch 4 times, most recently from ce80640 to 6b0ff2d Compare September 23, 2014 16:58
@Geod24
Copy link
Contributor Author

Geod24 commented Sep 23, 2014

Well, const(char)[] isn't really needed. And I don't want to multiply pointless overloads, so lazy string it is.

@s-ludwig
Copy link
Member

Alright, that's fine by me, too. Merging.

s-ludwig added a commit that referenced this pull request Sep 24, 2014
Bring vibe.d's enforce closer to std.exception.enforce
@s-ludwig s-ludwig merged commit 82ce674 into vibe-d:master Sep 24, 2014
@Geod24 Geod24 deleted the enforce-returns branch September 25, 2014 18:04
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.

2 participants