Giter Club home page Giter Club logo

Comments (9)

tylerreisinger avatar tylerreisinger commented on June 9, 2024 4

I've created a repository at https://github.com/tylerreisinger/approx_derive to implement it. When it is production ready, I can transfer ownership or merge it into the approx repo with a cargo workspace.

from approx.

tylerreisinger avatar tylerreisinger commented on June 9, 2024 1

@joshburkart It's not ready for a PR yet, but I can work on it a bit this weekend and see if I can get something working. TryFrom being stabilized helps with an issue implementing it.

from approx.

tylerreisinger avatar tylerreisinger commented on June 9, 2024

Is the last blanket impl necessary? You could always just create a macro to create the implementation for foreign types if needed

from approx.

tylerreisinger avatar tylerreisinger commented on June 9, 2024

Here's a pretty quick and dirty example of the sort of thing needed: https://gist.github.com/tylerreisinger/886e56379beffabddaff7bad6a232f06. It can only handles structs and won't insert type bounds on generics, but otherwise works.

from approx.

tylerreisinger avatar tylerreisinger commented on June 9, 2024

Also, there is no clean way to deal with both non-primitive Epsilon types and a mix of f32/f64 types without TryFrom, which is currently unstable. I used as in my example, as I'm guessing non-primitive Epsilons aren't that common.

from approx.

aldanor avatar aldanor commented on June 9, 2024

A nice thing to have would be a derive-proc-macro, so you could do

#[derive(AbsDiffEq)]
struct MyStruct { ... }

thus avoiding all the repetitive boilerplate on a per-struct basis.

from approx.

joshburkart avatar joshburkart commented on June 9, 2024

This would be really great to have! Approximately comparing nested structs/enums is a pretty common use case when writing tests for numerical computing applications. @tylerreisinger Do you think the implementation you made is ready for a PR in some form? Or too hacky right now?

from approx.

brendanzab avatar brendanzab commented on June 9, 2024

Yeah, having this would be really nice! I know it'll be a bit annoying with the epsilon though, and haven't had much time at the moment to look into it.

from approx.

linclelinkpart5 avatar linclelinkpart5 commented on June 9, 2024

I'd love to have this as well!

from approx.

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.