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
Add TypeInfo
functions analogs
#928
Conversation
What functions need these, though? |
|
Tweaked |
Rebased and moved to |
|
||
/** Templated setter to object's `init` state. | ||
|
||
Use this function instead of dealing with tricky $(D typeid(T).init()). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't say what the function does, only how it can be useful to advanced programmers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phobos' programmers must be advanced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add that »dealing with tricky xyz« doesn't strike me as particularly descriptive (if you are just reading the docs, what tricky aspects of .init does it avoid)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tricky aspects as TypeInfo
has lots of them.
* add `std.conv.setToInitialState`
* add `std.conv.callPostblits` * add `std.conv.callDestructors`
Fixed terrible name bug: renamed |
@@ -3642,6 +3642,238 @@ unittest | |||
assert(i is k); | |||
} | |||
|
|||
|
|||
/** Sets the passed object to its `init` state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is non-public, ddoc should not be generated for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. And where is the problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use a ddoc comment if it's not supposed to end up in the documentation. Use a regular comment.
|
||
/** Sets the passed object to its `init` state. | ||
|
||
Use this function instead of dealing with tricky $(D typeid(T).init()). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's tricky
? If a user doesn't know why, this comment doesn't help them at all.package
anyway, so doc comment quality doesn't matter that much.
That's a misguided comment. druntime can have templates, and has some trivial templates. However, It has no access to traits or typetuple, making anything that does any kind of introspection, virtually impossible. Currently, there is (afaik) nothing in druntime that has a behavior dependent on introspection: This why we have the whole fiasco with "Is array appending safe or nothrow? Who knows!?". |
Closing as there is no activity for a whole year. |
It is needed for various Phobos functions.
Requires pull #924.