Git Product home page Git Product logo

impl_sum's Introduction

impl_sum

This is an experimental implementation of automatically generated anonymous sum types as described in rust-lang/rfcs#2414. The current implementation has many limitations, some of these are avoidable with a bit more effort, others are (as far as I'm aware) unavoidable when implementing via a procedural macro.

There are two major limitations with this implementation that could be avoided by an in-compiler implementation:

  • The biggest unavoidable limitation is that the supported traits need to be explicitly specified in this repository. This could potentially be avoided via a generic delegation mechanism such as described in rust-lang/rfcs#2393, although I believe that at a minimum some of the proposed extensions to that RFC would also have to be implemented.

  • There needs to be an expression level marker for this implementation, an in-compiler implementation could avoid this by instead collecting all points at which it fails to unify expression types that end up being unified with the return type.

  • Only a single anonymous sum type per function is supported. This is because of how the proc-macro walks the function AST and replaces all calls to impl_sum! by a specific wrapper. There's currently no way for this to distinguish between different parts of the return value, and all solutions I can think of would be rather cumbersome to use.

Old limitations that have been dropped:

  • No implicit returns.
  • Only the top-level of the returned type is supported

impl_sum's People

Contributors

nemo157 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.