Giter Site home page Giter Site logo

efg's People

Contributors

dtolnay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

efg's Issues

specifying ranges

rust-lang/rfcs#3036 describes a family of predicates to target minimum versions of platform APIs. For example min_libc_version would return the version of libc. It was expected that max_* variants would be specified eventually as well 1, allowing ranges of OS versions to be targeted.

Unfortunately the RFC hasn't seen any updates in a while, but the challenges it attempts to address still exist. I'm wondering whether efg could help prototype syntax to specify ranges within attributes. It'd be neat if we could target a specific version range Windows by writing something like this:

#[cfg(windows && os_version >= "6.0.6000" && os_version < "7.3.5000")]

Or possibly taking it further and allowing shorthands such as:

#[cfg(windows && "6.0.6000" <= os_version < "7.3.5000")]

I'm not sure what this feature should look like, but I think having the ability to specify ranges using shorthands would be neat as well. What do you think?

Footnotes

  1. Being able to specify the maximum OS version is useful when you're writing polyfills for older versions. This would allow a developers to say something like: "This code runs on windows 10+ only", which can be leveraged to produce more optimized code. โ†ฉ

Suggestion: change `=` operator to `==` and add `!=` in 0.2

First of all, I think this crate is a great idea! It always irked me how verbose the syntax for cfg was compared to regular Rust.

Suggestion: if we're going for syntax simplification, I'd love to also simplify frequent not(feature = "somefeature") not only to !(feature = "somefeature") but all the way to feature != "somefeature".

It feels a lot more natural to use != operator, but I suspect it will also require changing = to more Rust-like ==. It would be a breaking change, but perhaps a good thing for consistency with the rest of Rust syntax.

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.