-
-
Notifications
You must be signed in to change notification settings - Fork 668
WIP (do not merge): Make in mean scope const in DIP1000
#10506
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
Conversation
|
Thanks for your pull request and interest in making D better, @atilaneves! 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 references
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#10506" |
|
It looks like some of the builds are failing because of link errors. The reason for that is likely that one object file was compiled with Of course this can be fixed by compiling all object files with the same flags on our side (upstream dlang), but it's likely that users will experience similar problems in the wild. For example, if we ship druntime and phobos compiled with I think the best solution is to have |
|
It might work if you also add I'd prefer if that transformation would be done during the semantic phase, though, so the parse tree is unmodified. For example dumping a header file will not keep the |
Wait I think that bug was fixed ? It was a prerequisite to make Phobos compiler with |
I tried doing it then and failed miserably to find where the information was being passed from the declared storage class to meaning |
in mean scope const in DIP1000in mean scope const in DIP1000
It doesn't work.
Could you point me in the right direction, please? I still haven't been able to find where the handover happens. |
|
Currently blocked by this Phobos PR. |
|
I think it adds it to the semantics, but it is then suppressed in stcToBuffer: Lines 2668 to 2669 in 83fde70
I noticed another reason why it is not enough to modify the parser: Line 1746 in 83fde70
The current transformation Lines 1949 to 1959 in 83fde70
But that's the wrong place to add a storage class. I'd try adding before Line 461 in 83fde70
|
I saw that. But at least it passed on a few OSs now. |
|
@atilaneves this PR should fix the BuildKite dub failure: dlang/dub#1791. |
That didn't work, here's a possible solution: #10526 |
|
@rainers @atilaneves now that dlang/dub#1791 was merged, dub is now build-able with this branch of dmd (as well as dmd >= 2.088.1 with and without And the failing code in question is: Whereas Here's a minimal test case: struct HTTP
{
@property void onReceiveHeader(
void delegate(scope const char[] key, scope const char[] value) callback)
{
}
}
void main()
{
import std.conv : to;
size_t contentLength;
HTTP http;
http.onReceiveHeader((k, v)
{
if (k == "content-length")
contentLength = to!size_t(v);
});
}(you can test it here: https://run.dlang.io/gist/run-dlang/f2d2f7141d1a8466bc7eacce3bc9cbb2?compiler=dmd) It compiles fine with @rainers My understanding is that #10526 changes |
While I don't think this PR (#10506) should be merged as it is, I'm still interested to see how far we can go with this approach and see how it fares in the real world (or at least in BuildKite, past the |
|
An more reduced test case: Seems like dmd is unable to deduce the function literal type as soon as scope is involved. |
I'm unsure, too, especially since |
Yep. Here's an odd idea: introduce a new mangling for |
Yeah, that's what I thought, too. We'd have to avoid removing |
cce44e0 to
0d146e8
Compare
|
Even more reduced test case to highlight the Windows failure (which is due to the druntime tests there not being compiled with -preview=dip1000): void stringify(scope void delegate(scope const char[]) sink) {
sink("oops");
}
void main() {
string str;
stringify((chars) {str ~= chars; }); // won't compile
}With -preview=dip1000 this compiles. Without, it doesn't. Adding |
|
I filed a dmd bug. |
|
Regarding: Replacing : With: Works. However: Does not. Not sure why the |
@WalterBright : This is one of the bugs blocking |
Why? Why is |
For starter, it's not possible to do it automatically. So I ended up grepping for It's not difficult, it is a worthless use of time. |
Ouch! should do the trick (case sensitive and words only). You can go further with: and this will send a list of files with those matches to your editor (my editor is |
yes except |
I didn't knew about the
We have |
|
Wrt to the regexp, this is far better: But, still has a lot of ifs, pragmas, asserts, etc. There's no easy way to grep for a function, you need a parser. Regarding scope changing meaning, I think that's a good thing. |
in mean scope const in DIP1000in mean scope const in DIP1000
|
Closed in favour of #10769 |
No description provided.