GithubHelp home page GithubHelp logo

Comments (5)

apoelstra avatar apoelstra commented on July 23, 2024 1

I guess we can certainly write a proc-macro which does nothing (except maybe when compiled with a specific flag, in which case it writes out some files) and then we definitely make up our own annotations.

from rust-bitcoin.

apoelstra avatar apoelstra commented on July 23, 2024

I wonder if there's an easy way we can identify "types with invariants".

I guess, anything that's a newtype around a single type is probably one.

Can we tag stuff with like, #[rust_bitcoin::has_invariant] or will rustc/clippy/whatever complain?

from rust-bitcoin.

15IITian avatar 15IITian commented on July 23, 2024

@apoelstra
I think we should create a privacy barrier -> as we have done so for the PushBytes related stuffs by introducing primitive module-> in order to have uniformity in our codebase.

Still if we decide to go with clippy or tag stuffs etc -> then IMO, we have to make changes for the PushBytes related stuffs as well.

from rust-bitcoin.

sanket1729 avatar sanket1729 commented on July 23, 2024

Strong concept ACK. I have been doing it for me personal projects. Related #1327.

from rust-bitcoin.

Kixunil avatar Kixunil commented on July 23, 2024

I wonder if there's an easy way we can identify "types with invariants".

Could be types that are Foo(X); with impl Foo { fn ...(...: X) -> Result<Self, ...> } or with TryFrom<X> for Foo.

I guess, anything that's a newtype around a single type is probably one.

Counterexamples: Amount, Weight, FeeRate...

from rust-bitcoin.

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.