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

Projects
None yet
2 participants
@Geod24
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Sep 23, 2014

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?

Member

s-ludwig commented Sep 23, 2014

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

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Sep 23, 2014

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.

Member

s-ludwig commented Sep 23, 2014

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

This comment has been minimized.

Show comment
Hide comment
@Geod24

Geod24 Sep 23, 2014

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Sep 24, 2014

Member

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

Member

s-ludwig commented Sep 24, 2014

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

s-ludwig added a commit that referenced this pull request Sep 24, 2014

Merge pull request #839 from Geod24/enforce-returns
Bring vibe.d's enforce closer to std.exception.enforce

@s-ludwig s-ludwig merged commit 82ce674 into vibe-d:master Sep 24, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@Geod24 Geod24 deleted the Geod24:enforce-returns branch Sep 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment