GithubHelp home page GithubHelp logo

Comments (4)

adaszko avatar adaszko commented on July 30, 2024 1

It’d be lovely to revisit this issue now that GATs have been stabilized. Has anybody experimented with it? :)

EDIT: A bit about my use case: Due to proptest not supporting non-owned types, I’m unable to randomly generate a tree value whose nodes are allocated in an arena (bumpalo) because I can’t store &Child references in the node type. I’m forced to allocate with Box::new() and Vec<> to create the nodes.

from proptest.

AltSysrq avatar AltSysrq commented on July 30, 2024

I do think it'd be useful, but I also agree that this definitely requires GATs. (If trait aliases become a thing, there might also be a viable option of just adding a lifetime parameter to all the traits that most people wouldn't have to deal with.)

I think the problem bears a lot of similarity to "streaming iterators", so it might be best to wait and see how that gets solved and then follow suit.

from proptest.

Centril avatar Centril commented on July 30, 2024

Agreed, it is similar to streaming iterators. Once GATs lands I will do some prototyping on nightly to see how much the interface has to change to accommodate generation of borrowed types and how much we have to modify the strategies already provided.

If we find a good solution we can perhaps develop it as a separate branch and then merge it in once GATs for lifetimes are stabilized (which might be before GATs for types).

from proptest.

Ten0 avatar Ten0 commented on July 30, 2024

Hmm while GATs may be the correct way to represent this, they look unlikely to be stabilized anytime soon, and I'm curious as to why this wouldn't work if Strategy and ValueTree were simply generic on 'a.
It feels to me it would work, with ValueTree holding the owned data and generating the non-owned structures on call to current. current on ValueTree would take &'a self.
We would always implement ValueTree and Strategy for every 'a and use for<'a> T: Strategy<'a> wherever required.

from proptest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.