Giter Site home page Giter Site logo

Comments (5)

bastibl avatar bastibl commented on May 19, 2024

Yes, this is true. There are, at least at the moment, many ways to shoot yourself in the foot, if you really want to. I spent quite some time to come up with an API that uses more strict typing, but it's really not as trivial as it may seem on first sight. If you have concrete suggests, your PR will be very much appreciated.

from futuresdr.

bytesnake avatar bytesnake commented on May 19, 2024

no I just started to read the source and stumbled on https://github.com/FutureSDR/FutureSDR/blob/main/src/blocks/fft.rs#L104 which made me take note here. It would be great to at least check that all downstream node's scalar are compatible to the input scalar of current node.

from futuresdr.

bastibl avatar bastibl commented on May 19, 2024

You can cast the stream inputs and outputs to anything. That's not specific to this mutable reference to the input. It's the case for all stream connections.

A runtime check should be rather easy to implement by requiring any item type to implement Any and store the TypeId in the stream port. But that's just a runtime check... not sure if this is good enough for you.

from futuresdr.

bytesnake avatar bytesnake commented on May 19, 2024

A runtime check should be rather easy to implement by requiring any item type to implement Any and store the TypeId in the stream port. But that's just a runtime check... not sure if this is good enough for you.

that would definitely be the reasonable way to go 👍

from futuresdr.

bastibl avatar bastibl commented on May 19, 2024

Implemented in ba57854.

Stream inputs/outputs are created with the actual type add_input::<T>("in")/add_output::<T>("out"). The actual ports remain non-generic, since only the any::TypeId of T is stored.

This TypeId is checked during connection and when casting the slice in work. There are also slice_unchecked versions, which ignore this check, since some blocks are, for example, easier to implement by casting it to a u8 slice in work.

from futuresdr.

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.