Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Move some traits to druntime #2742

Merged
merged 1 commit into from
Aug 23, 2019
Merged

Conversation

TurkeyMan
Copy link
Contributor

I need these for core.atomic...

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @TurkeyMan! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

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

Your 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 locally

If 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 + druntime#2742"

}

private template AliasThisTypeOf(T)
if (isAggregateType!T)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be indented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Really? Every constraint I've seen has been intended... that's how you know it's a constraint.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, "Constraints on declarations should have the same indentation level as their declaration".

Copy link
Contributor Author

@TurkeyMan TurkeyMan Aug 19, 2019

Choose a reason for hiding this comment

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

  1. that's horrible.
  2. it's already a 50/50 split in druntime. i think it actually leans in favour of this way, which is why i went with this way.
  3. it doesn't make sense, line-breaks always warrant an indentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

AIUI, it's only split because the style guide was written/followed after a lot of the code had already been already written. I'm not sure I agree with this rule either, but it's required by the style guide...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well someone can produce a PR that fixes all the code in one hit.

}

template isFunctionPointer(T...)
if (T.length == 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

}

template isDelegate(T...)
if (T.length == 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto


template FieldTypeTuple(T)
// TODO: deprecate these old names...?
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we just remove them? It's core.internal so should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a large project.

Copy link
Contributor

Choose a reason for hiding this comment

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

FieldTypeTuple is only used in this file. TypeTuple is used elsewhere in druntime too, but I can make a follow-up PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Go for it!

@JinShil
Copy link
Contributor

JinShil commented Aug 19, 2019

If these came from Phobos, I think the unittests should be moved as well. A followup PR to Phobos to import them from druntime (and remove them from Phobos) would also be prudent IMO.

@lesderid
Copy link
Contributor

If these came from Phobos, I think the unittests should be moved as well. A followup PR to Phobos to import them from druntime (and remove them from Phobos) would also be prudent IMO.

Other traits that were moved to druntime still have their unittests in Phobos because then they can still be used as examples (documentation isn't generated for core.internal).

@TurkeyMan
Copy link
Contributor Author

A followup PR to Phobos to import them from druntime (and remove them from Phobos) would also be prudent IMO.

I have a follow-up, but it won't build until this is merged... so I haven't pushed it.

@TurkeyMan
Copy link
Contributor Author

Why has buildkite gone on holiday? All PR's are not building...

@lesderid
Copy link
Contributor

Why has buildkite gone on holiday? All PR's are not building...

Looks like the CI agent went offline, I can't ping the IP and Buildkite says 'lost connection'.

@wilzbach
Copy link
Member

The CI agents are continuously spawned based on demand. Looks like there's a problem with that logic currently, but it should very likely recover over the next the hours. Not blocking the approval of this PR.

Copy link
Member

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

Their unittests should be moved too, because then Phobos can be a mere alias (and public example), but it's a bit tricky if we separate implementation from their tests.

@TurkeyMan
Copy link
Contributor Author

Their unittests should be moved too, because then Phobos can be a mere alias (and public example), but it's a bit tricky if we separate implementation from their tests.

Documented tests stay in phobos, and the tests are documented tests.
We do this for all the other tests.

We would need to do a pass to move all the docs over to druntime, which would mean moving core.internal.traits to core.traits... that's way outside the scope of this PR, I'm not changing any organisation here.

@JinShil
Copy link
Contributor

JinShil commented Aug 19, 2019

I think only those unittests with a /// DDoc header are used for documentation (@wilzbach, please correct me if I'm wrong). Can we at least move the unittests which are not used for documentation? For example: https://github.com/dlang/phobos/blob/81572ffce650cb17319c63927cffa6f1e345a094/std/traits.d#L7543-L7555

@TurkeyMan
Copy link
Contributor Author

@JinShil That is duplicated in druntime and phobos (because not public)... are you saying the unit test should exist in both places?

@JinShil
Copy link
Contributor

JinShil commented Aug 19, 2019

are you saying the unit test should exist in both places?

With regard to ModifyTypePreservingTQ, it is package. and since these traits are being moved to core.internal, I would expect the entire thing (unittests and implementation) to be moved to druntime and made public. Then it can be package-imported in Phobos. e.g.

package import core.internal : ModifyTypePreservingTQ;

I don't know if package import is a thing though; I'll have to try it out.

Edit: However, my prior comment was more general. I suggest moving the unittests that are not documentation unittests to druntime where the implementation is.

@JinShil
Copy link
Contributor

JinShil commented Aug 19, 2019

I don't know if package import is a thing though; I'll have to try it out.

Even if package import is not legal, you can still make ModifyTypePreservingTQ public in druntime and then make a package wrapper like you did with some of the other imports in dlang/phobos#7148

@TurkeyMan
Copy link
Contributor Author

Oh FFS!! See what happens! I move the tests over and they depend on 90% of phobos...
This happens every time! That's why I don't do it.

This is blocking me, one of you can fix this. Please be fast...

@TurkeyMan
Copy link
Contributor Author

I want to start getting paid for the time wasted by bullshit like this. I have finite lifetime, and it's worth $100/hr.

@TurkeyMan TurkeyMan force-pushed the move_some_trsits branch 3 times, most recently from 55cba5e to 8f0cfe2 Compare August 20, 2019 02:55
@TurkeyMan
Copy link
Contributor Author

Should merge this; everyone got bent-out-of-shape about the tests... and from here I can push the phobos PR...

@TurkeyMan
Copy link
Contributor Author

Surely this is trivial?

@dlang-bot dlang-bot merged commit 396a0ec into dlang:master Aug 23, 2019
@TurkeyMan TurkeyMan deleted the move_some_trsits branch August 23, 2019 07:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants