phobos icon indicating copy to clipboard operation
phobos copied to clipboard

Add Quote to make passing multiple tuples easier

Open yshui opened this issue 7 years ago • 10 comments

yshui avatar Jul 26 '18 15:07 yshui

Thanks for your pull request and interest in making D better, @yshui! 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 annotated coverage diff directly on GitHub with CodeCov's browser extension
  • 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 + phobos#6643"

dlang-bot avatar Jul 26 '18 15:07 dlang-bot

Finally our CIs are giving sensible error messages :)

std/meta.d(86:8)[warn]: Public declaration 'Quote' has no documented example.
[Inferior 1 (process 2276) exited with code 01]

wilzbach avatar Jul 26 '18 15:07 wilzbach

@wilzbach It'd better if the linter can output all the warnings at once.

yshui avatar Jul 26 '18 15:07 yshui

@wilzbach It'd better if the linter can output all the warnings at once.

This message is related to new code you pushed - how should the linker have known about this before? But yeah, there's currently a two-stage linting (because some simple things weren't possible with DScanner), we yes we could at least run all "tests" in stage 1 and not immediately abort. Anyhow, on Posix you can run it locally:

make -f posix.mak style

(there are sub make targets too)

wilzbach avatar Jul 26 '18 15:07 wilzbach

@wilzbach ping.

yshui avatar Jul 27 '18 09:07 yshui

Why is it called "Quote"? Is this supposed to be a "PackedAliasSeq"?

Have you seen: https://github.com/yshui/phobos/blob/1c4a6ed23624cd439ad0f95042dd445a2e51b3c2/std/meta.d#L1762 ?

It would also be nice to see some use-cases in unittests to get a bit of a feel on how it can be used practically.

aliak00 avatar Aug 02 '18 14:08 aliak00

@aliak00 whoops, don't know how I missed that...

yshui avatar Aug 02 '18 18:08 yshui

IMO, the correct terminology is AliasTuple, for the same reason we renamed TypeTuple to AliasSeq:

  1. It is an alias to a sequence of arbitrary compile-time entities (not only types), like symbols, values, overload sets, etc.
  2. Tuples don't auto-expand while "sequence" implies a loose list-like structure, so expanding is a given.

AliasTuple doesn't auto-expand (i.e. the tuple part) and is an alias to a sequence of arbitrary CT entities.

PetarKirov avatar Aug 03 '18 06:08 PetarKirov

I'm fine with whatever names you come up with.

Question is should I adapt Pack and make it public, or should I add a new template?

yshui avatar Aug 03 '18 13:08 yshui

My vote would go to adapting pack and fixing up the API. I have something similar in a library for some ideas:

https://github.com/aliak00/bolts/blob/a6d9e7830c915e11667fc1ad2e80f323cb314cdc/source/bolts/meta.d#L108

There's also this forum post:

https://forum.dlang.org/post/[email protected]

aliak00 avatar Aug 03 '18 14:08 aliak00