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

Put fix 3 #1569

Merged
merged 4 commits into from
Nov 23, 2013
Merged

Put fix 3 #1569

merged 4 commits into from
Nov 23, 2013

Conversation

monarchdodra
Copy link
Collaborator

Third attempt at fixing put. I think this could be the good one.

This new version is capable of transcoding any character/string of any width, to any character/string of any width. It does this (if I may say so), rather efficiently too.

This basically "fixes" the totality of std.format, which sometimes needs to put a dchar in the output stream, made simple code such as formattedWrite((const(char[]) s){}, "%s", "string"); fail to compile. Now, we can even do things like formattedWrite((const(char[]) s){}, "%s", "string"d); (notice the "d). Yay!

Added some optimizations for array to array copy too.

For what this does, I also think the "flow" is as simple as we can get it to be. I tripple checked all the code paths, and I made sure using -cov that all roads are taken and validated.

As a helper feature, I defined doPut, which is "put without any features", and it's corresponding trait isNativeOutputRange. This is used strictly internally, and is not made public to the user.

)

Tip: $(D put) should $(D not) be used "UFCS-style", eg $(D r.put(e)).
Doing this may call $(D R.put) dirrectly, by-passing any transformation
Copy link
Member

Choose a reason for hiding this comment

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

Typo. "directly"

@monarchdodra monarchdodra mentioned this pull request Nov 22, 2013
@yebblies
Copy link
Member

This looks good. I'm planning to merge unless there are any serious objections.

Please rebase so the autotester has a go at it.

@monarchdodra
Copy link
Collaborator Author

This looks good.

Thanks :)

Please rebase so the autotester has a go at it.

Done.

@yebblies
Copy link
Member

Auto-merge toggled on

yebblies added a commit that referenced this pull request Nov 23, 2013
@yebblies yebblies merged commit 21e6cb9 into dlang:master Nov 23, 2013
@monarchdodra monarchdodra deleted the putFix3 branch March 12, 2014 22:32
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.

3 participants