Add ArrayElementType template (fixes issue 5061)#776
Add ArrayElementType template (fixes issue 5061)#776denis-sh wants to merge 2 commits intodlang:masterfrom
ArrayElementType template (fixes issue 5061)#776Conversation
* ArrayElementType (12)
|
Does not std.traits.ForeachType/std.range.ElementType fit the purpose? |
|
@shoo, see pull 664 comments please. |
|
I still think that this is pointless code duplication. |
|
Is there any actual reason |
My opinion is in pull 664 comments. I can only add this: |
|
But those functions are there to actually make code easier to write, i.e. you have to do fewer calls in your code. This just seems like (effectively) an alias of |
I see same calls count in every case:
More precisely it is |
I don't know what that is...
Let's not get pedantic (where's But I think I now see your point: You want this trait because it only allows passing array types. While I can't think of idiomatic D code that wouldn't allow both range and array types in templatized code, I suppose it is reasonable to have this trait here for consistency if nothing else. |
Template code is rather difficult in D and it often not obvious what type can be used in particular place. And if you see
See this pull diff for examples in Phobos. |
|
I appreciate the arguments in favor of adding an ArrayElementType. However, ElementEncodingType is adequate (albeit unintuitively named) and I couldn't get convinced by the arguments involving precedents. I will close this now. Thanks for the contribution, and let's focus on the more meaty ones. |
|
Do I get the timing right in the github logs? |
Yes.
As I disagree with rejecting of this pull and I always use |
This supersedes accidentally merged and then reverted Pull #664.
Issue 5061 - std.traits.arrayTarget
See pull 664 comments for information/opinions.