Skip to content

Add support for arrays powered by const generics without unsafe or libs#311

Closed
Mathspy wants to merge 2 commits into
BurntSushi:masterfrom
Mathspy:add-support-for-arrays
Closed

Add support for arrays powered by const generics without unsafe or libs#311
Mathspy wants to merge 2 commits into
BurntSushi:masterfrom
Mathspy:add-support-for-arrays

Conversation

@Mathspy
Copy link
Copy Markdown
Contributor

@Mathspy Mathspy commented Jun 7, 2022

Closes #187

Alternative to #282 that does not use unsafe

This seems to have been a heavily requested feature since 2017 now but the hold back was that implementing array support via macros heavily impacts compile times, is limited to some predefined arbitrary length and bloats the docs with unnecessary clutters. The wait was for const generic stabilization which is finally upon us, so we can utilize that and add array support!

Also lol while I was writing the shrink implementation I was like uff too much cloning there's probably a way to write this better that Sushi will tell me about, then while opening this PR I decided to double check there are no PRs open that already do this, which is when I found #282 and saw the exact same implementation I reached. Now I feel much less bad about the implementation

@Mathspy Mathspy changed the title Add support for arrays powered by const generics Add support for arrays powered by const generics without unsafe or libs Jun 7, 2022
@arkeet
Copy link
Copy Markdown

arkeet commented Jun 27, 2022

I was looking to add this as well and came up with exactly the same implementation before seeing there was already a PR. Would be nice to see this get in.

@cloudhead
Copy link
Copy Markdown

FWIW I've published a fork of this library called qcheck under here: https://github.com/cloudhead/qcheck

It includes this change as well as a bunch of others that made sense to include.

@jhpratt
Copy link
Copy Markdown
Collaborator

jhpratt commented Mar 5, 2025

closing as #319 was merged

@jhpratt jhpratt closed this Mar 5, 2025
@Mathspy
Copy link
Copy Markdown
Contributor Author

Mathspy commented Mar 5, 2025

Looks like the other PR doesn’t handle shrinking

@jhpratt
Copy link
Copy Markdown
Collaborator

jhpratt commented Mar 6, 2025

🤦 You're absolutely correct. Mind opening a PR for adding shrinking to the now-existing implementation? If you'd rather I can copy over your code myself.

@Mathspy
Copy link
Copy Markdown
Contributor Author

Mathspy commented Mar 6, 2025

🤦 You're absolutely correct. Mind opening a PR for adding shrinking to the now-existing implementation? If you'd rather I can copy over your code myself.

Opened #330

Thank you for taking over maintenance of the library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Arbitrary for [T: Arbitrary; N]

4 participants