Giter VIP home page Giter VIP logo

genrc's People

Contributors

jpetkau avatar

Stargazers

 avatar

Watchers

 avatar

genrc's Issues

Better way to express lifetimes

I'm not super happy with the Rcl / Arcl types. Several alternate approaches
are possible but they all have their own tradeoffs.

  1. If it was possible to default lifetimes, then Rcl could be named Rc and
    the lifetime param just defaulted to static.
    https://internals.rust-lang.org/t/lifetime-parameter-default-value/1722.
    Maybe someday.

  2. type Rc<'a, T> = Genrc<'a, T, ...>, i.e. only have the lifetime-containing
    version. This works fine in normal code, but now you need an explicit
    'static or 'a in any structs containing Rc so it's much less of a
    drop-in replacement, and it's kinda ugly. (Cow<'static, T> has the same
    problem.)

  3. Make Rc<T> contain a phantom T instead of a phantom &T, and Rcl<T> a
    completely different type. This makes Rc a better drop-in replacement for
    std::rc::Rc, but means there must be two different Rc::project()
    functions, one that erases the lifetime and one that doesn't, and it's harder
    to write generic code over both.

  4. Make the general version Rc<T, L>, replacing the lifetime parameter with
    a type that might have a lifetime, e.g. Rc<i32, &'a i32>. But now the
    type L contains too much info; we really want it to be either () or
    &'a (), but there's no convert an arbitrary lifetime-containing type to
    a minimal type that just expresses the lifetimes.

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.