-
-
Notifications
You must be signed in to change notification settings - Fork 422
Implement templated version of _d_newThrowable
#3661
Conversation
|
Thanks for your pull request and interest in making D better, @teodutu! 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 run digger -- build "master + druntime#3661" |
|
Is your initial goal just to get it working, then go back later to redo the implementation? |
To a certain extent, yes, but if there's something that needs improving, I'll try to do it now. |
|
@adamdruppe if you have any suggestions, feel free to comment. If there isn't anything blocking us from applying them, we will most certainly will. We want to have the best possible version of the code. |
|
The way I'd actually do it is
This kind of type erasure keeps the template function itself small to avoid code bloat inside druntime by duplicating the generation of the implementation over and over again, while still taking advantage of the template to remove extra RTTI dependencies. Since this is a small function anyway it might not matter much but still this is how I'd attempt all the template transitions. But also this is an impl detail that can be done in a second pass. |
Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
…rowable` Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
a391118
to
da9a400
Compare
I think I can template-ise the hook right away, without resorting to this. I believe I've already done so by following @MoonlightSentinel's advice and using |
|
@teodutu ping me when this is ready. |
|
@RazvanN7 I'd say it is. It no longer uses |
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.
Looks goot to me. cc @adamdruppe @MoonlightSentinel
|
I think this is good as it is now. The forwarding pattern is useful in other cases but here I don't think it would be a significant difference either way, so we can keep it simple and come back to tweak the implementation later if it proves to be a problem. |
It was replaced by a template hook: - dlang#3661 - dlang/dmd#13494 Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
This adds a templated version of
_d_newThrowableto be used for lowering expressions likethrow new E("something");in the compiler's frontend.