Skip to content
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

fix issue 18149 - Add a compiler trait to detect if a function is @disable #7569

Merged
merged 1 commit into from Jan 18, 2018
Merged

fix issue 18149 - Add a compiler trait to detect if a function is @disable #7569

merged 1 commit into from Jan 18, 2018

Conversation

ghost
Copy link

@ghost ghost commented Dec 31, 2017

Although there's not much concrete application (since a call to a @disable function is already statically checked) for now there is no way to know if a function is @disable.

@ghost ghost requested a review from WalterBright as a code owner December 31, 2017 15:20
@dlang-bot
Copy link
Contributor

dlang-bot commented Dec 31, 2017

Thanks for your pull request, @bbasile! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Auto-close Bugzilla Description
18149 Add a compiler trait to detect if a function is @disable

@ghost ghost changed the title fix issue 18149 - Add a compiler trait to detect if a function is @disabled fix issue 18149 - Add a compiler trait to detect if a function is @disable Jan 1, 2018
@JinShil
Copy link
Contributor

JinShil commented Jan 1, 2018

Is there any particular reason why @disable can't be added to the getAttributes trait?

UPDATE: I see that once a function is marked with @disable, getAttributes cannot be used on it. Adding @disable to getAttributes would introduce a breaking change (and may not even be appropriate; I'm still unsure about it).

@ghost
Copy link
Author

ghost commented Jan 1, 2018

Adding @disable to getAttributes would introduce a breaking change (and may not even be

Yes. This and also it'd be for the getFunctionAttributes verb (the one you ask for is for the UDAs). There's a lot of code in std.typecons that relies on them and @disable would not being usable in the same fashion anyway (typically all the wrappers things).

@JinShil
Copy link
Contributor

JinShil commented Jan 1, 2018

I'm itching to approve this, but before then it needs a changelog entry in this PR and a documentation update at https://github.com/dlang/dlang.org.

@JinShil JinShil added Needs Changelog A changelog entry needs to be added to /changelog Needs Spec PR A PR updating the language specification needs to be submitted to dlang.org labels Jan 1, 2018
@JinShil JinShil removed the Needs Spec PR A PR updating the language specification needs to be submitted to dlang.org label Jan 2, 2018
@ghost
Copy link
Author

ghost commented Jan 2, 2018

@JinShil, a changelog entry is not needed. An issue is referenced so it would appear even without.

@JinShil
Copy link
Contributor

JinShil commented Jan 2, 2018

@JinShil, a changelog entry is not needed. An issue is referenced so it would appear even without.

Yes, I know, and I generally agree, but I've been asked to add changelog entries for certain Bugzilla issues, even though they appear in list of fixed issues. The following are examples:

  1. https://dlang.org/changelog/2.078.0.html#fix16997
  2. https://dlang.org/changelog/2.078.0.html#fix11006

This is a new feature and I think it is appropriate to do some advertising for it.

@PetarKirov
Copy link
Member

We have had examples of both adding a dedicated changelog entry and relying on Bugzilla (e.g. https://dlang.org/changelog/2.078.0.html#bugfix-list - isFuture). IMO we should add changelog entries for all enhancement requests which allow expressing new things in the language, that were not easily doable before.

@RazvanN7 can you add a changelog entry for isFuture?

@ghost
Copy link
Author

ghost commented Jan 2, 2018

Okay i 've just added the changelog entry and the good news is that this has revealed that the trait is much more useful than i thought.

@JinShil JinShil removed the Needs Changelog A changelog entry needs to be added to /changelog label Jan 3, 2018
Copy link
Contributor

@JinShil JinShil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bbasile. I'm going to leave this open for a little while to give others an opportunity to weigh in.

@wilzbach
Copy link
Member

wilzbach commented Jan 3, 2018

I'm going to leave this open for a little while to give others an opportunity to weigh in.

Yes this is a language change and thus needs approval from either @WalterBright or @andralex.

@@ -417,6 +417,11 @@ extern (C++) abstract class Declaration : Dsymbol
return (storage_class & STCdeprecated) != 0;
}

final bool isDisabled()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add const pure nothrow @nogc @safe

using `__trait(compiles)`, which was less than ideal since `false` could be
returned for other reasons.

Now, in your metaprogramming code, `@disable` functions can be detected accurately,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove your

Copy link
Member

@WalterBright WalterBright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comments

@JinShil
Copy link
Contributor

JinShil commented Jan 6, 2018

@WalterBright Are you willing to explicitly mark this "Approved"?

@JinShil
Copy link
Contributor

JinShil commented Jan 8, 2018

@bbasile Please rebase. It won't elicit any reviews unless it's passing.

@wilzbach
Copy link
Member

wilzbach commented Jan 8, 2018

@bbasile Please rebase. It won't elicit any reviews unless it's passing.

What do you mean by this? I don't see any merge conflicts and only auto-tester has one spurious failure, but auto-tester automatically invalidates and restarts all jobs if at any repo a PR is merged to master.

@WalterBright needs to dismiss his review (I could do that as well, but I'm not sure he explicitly approved the addition).

@JinShil
Copy link
Contributor

JinShil commented Jan 8, 2018

What do you mean by this?

It appears this code is using STCdisabled instead of the recently refactored STC.disabled. See the failure. That is why I assumed it needed to be rebased.

@wilzbach
Copy link
Member

wilzbach commented Jan 9, 2018

It appears this code is using STCdisabled instead of the recently refactored STC.disabled. See the failure. That is why I assumed it needed to be rebased.

Ah I see. Though we can easily do that and reduce the latency / "ping-pong" time ;-)

@wilzbach
Copy link
Member

wilzbach commented Jan 9, 2018

(I just rebased this PR)

@ghost
Copy link
Author

ghost commented Jan 11, 2018

Looks like there's a regression under OSX 32 bits, that happened between the 2018-01-10 22:21:41 and the 2018-01-10 11:23:11.

@JackStouffer
Copy link
Member

Looks like there's a regression under OSX 32 bits

Can we please stop spending precious dev time and stalling PRs to support this dead platform?

@wilzbach
Copy link
Member

Oh that's interesting. It looks similar to what @marler8997 is experiencing.
Yeah we definitely should switch that machine to do 64_64 testing only. CC @braddr
Alternatively we can also try to ping Brad here: https://github.com/braddr/d-tester/issues

@marler8997
Copy link
Contributor

Looking at the logs it is the same issue. I was able to reproduce on my macbook pro and got a stack trace. Note that this seg fault only occurs because the autotester is using dmd version 2.068.2, I was able to fix the problem on my macbook by using the next version, 2.069.0.

Here's the stack trace, maybe we should consider patching dmd 2.068.2?

Obj::term(char const*) + 2285
obj_end(Library*, File*) + 37
tryMain(unsigned long, char const**) + 12066
_start + 203
start + 33

@marler8997
Copy link
Contributor

marler8997 commented Jan 11, 2018

P.S. I worked around the issue by adding some printf statements to a certain locations in the code :) It was hours of painstaking trial and error to massage the code to not cause the segfault. Tedious work, but no one else is going to do it for me.

@braddr
Copy link
Member

braddr commented Jan 11, 2018

reminder: I do not define the supported platforms. I only implement them and remind people when they want them changed for whatever reason that those changes must go through the community and leadership team. I'm part of the former but not the latter. So, go, get approval for changing the supported platform set.

@ghost
Copy link
Author

ghost commented Jan 13, 2018

@wilzbach, circle ci here too doesn't work anymore, although it used to. I did rebase or amend several times yesterday and it's not triggered anymore (as for semaphore).

@wilzbach wilzbach closed this Jan 13, 2018
@wilzbach wilzbach reopened this Jan 13, 2018
@wilzbach
Copy link
Member

circle ci here too doesn't work anymore

Interesting that that only happens with your account, but it seems like closing & reopening worked here...

@ghost
Copy link
Author

ghost commented Jan 13, 2018

Recently i revoked circle-ci from my account...but i don't think this could be the cause.

@wilzbach
Copy link
Member

but i don't think this could be the cause.

It could also be related to the partial GitHub outage a couple of days ago:

https://status.github.com/messages

@dlang-bot dlang-bot merged commit c68ae00 into dlang:master Jan 18, 2018
@ghost ghost deleted the issue-18149 branch April 23, 2018 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants