dtemplate Tuple, add a ctor taking num elements#8554
Conversation
|
Thanks for your pull request and interest in making D better, @bbasile! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#8554" |
|
|
||
| extern (D) this(){} | ||
|
|
||
| extern (D) this(size_t numObjects) |
There was a problem hiding this comment.
We're trying to incrementally improve the dmd code base. One of the things we prefer is that any new public symbols have full DDoc headers with a description, params, and returns. I admit it's selectively enforced, and I don't think it should prevent a PR from being merged, but we would like contributors to put forth the effort. 😉
EDIT: Also please see https://dlang.org/dstyle.html#phobos_documentation. It's different from the rest of DMD but it's the style we want to incrementally migrate to (at least some of us).
There was a problem hiding this comment.
Yes of course. This is just a bit strange to start doing it when the practice is not generalized.
I had to amend anyway since the default ctor can be avoided using a default numObjects.
src/dmd/dtemplate.d
Outdated
| * Params: | ||
| * numObjects = The initial number of objects. | ||
| */ | ||
| extern (D) this(size_t numObjects = 0) |
There was a problem hiding this comment.
See item 12 here: https://forum.dlang.org/post/p6oibo$1lmi$1@digitalmars.com
I don't really like it, but you can avoid the default parameter by forwarding to a parameter-less constructor in the body of this constructor.
Edit: Of course, he also says "Minimize use of overloading." and "treating the above as sacred writ is a huge mistake.", so maybe we should keep it a default parameter.
There was a problem hiding this comment.
Yes but it's either that or a useless default ctor since default ctors ares till not auto generated ;)
There was a problem hiding this comment.
I'm guessing the preference would be:
/**
Constructs a new instance.
*/
extern (D) this()
{
this(0);
}
/**
Constructs a new instance.
Params:
numObjects = The initial number of objects.
*/
extern (D) this(size_t numObjects)
{
objects.setDim(numObjects);
}There was a problem hiding this comment.
No, with empty parens this would mean two useless call: other ctor overload and then objects.setDim.
src/dmd/dtemplate.d
Outdated
| Objects objects; | ||
|
|
||
| /** | ||
| * Constructs a new instance. |
There was a problem hiding this comment.
Please remove the prepended *.
src/dmd/dtemplate.d
Outdated
|
|
||
| /** | ||
| * Constructs a new instance. | ||
| * Params: |
There was a problem hiding this comment.
We really should have an updated style guide for all this that is linked from the readme or the contribute documentation.
src/dmd/dtemplate.d
Outdated
| extern (D) this() {} | ||
|
|
||
| /** | ||
| * Constructs a new instance. |
There was a problem hiding this comment.
This line is spurious, as that's what a this constructor does. Please delete it.
There was a problem hiding this comment.
I think all documented symbols should have a summary. This allows to automatically generate an index table, i.e. something like the table at the top of [1].
No description provided.