Giter Site home page Giter Site logo

Comments (6)

joperezr avatar joperezr commented on June 9, 2024

This makes sense, there is no particular reason why to use Span, so I agree that we should be using ReadOnlySpan for writing as well. I'm marking this up-for-grabs. @arkadiuszwojcik let me know if this is something that you would be interested in fixing.

from iot.

JeremyKuhne avatar JeremyKuhne commented on June 9, 2024

They should also use "buffer" as the term. And single items should be "value". So:

    public abstract class I2cDevice : IDisposable
    {
        protected I2cDevice();

        public abstract I2cConnectionSettings ConnectionSettings { get; }

        public void Dispose();
        public virtual void Dispose(bool disposing);
        public abstract void Read(Span<byte> buffer);
        public abstract byte ReadByte();
        // OLD: public abstract void Write(Span<byte> data);
        public abstract void Write(ReadOnlySpan<byte> buffer);
        // OLD: public abstract void WriteByte(byte data);
        public abstract void WriteByte(byte value);
    }

See https://apisof.net/ to find existing patterns. https://apisof.net/catalog/System.IO.Stream.WriteByte(Byte) for an example.

from iot.

shaggygi avatar shaggygi commented on June 9, 2024

I had a related discussion with @joperezr about data/buffer during an earlier PR. He might want to chime in on the thinking around naming.

from iot.

JeremyKuhne avatar JeremyKuhne commented on June 9, 2024

Note that I am not the API review process myself, but what I'm pointing out is based on my experience with that process. Which is hopefully going to get us closer than we would be otherwise. 😆

from iot.

krwq avatar krwq commented on June 9, 2024

@JeremyKuhne I've sent PR with the fix but did not include any naming changes

We should re-iterate on all of the APIs at one point separately

from iot.

joperezr avatar joperezr commented on June 9, 2024

I didn't know that we had an existing pattern for Write where we also called it buffer. What @shaggygi and I discussed in the past, was that it made sense for reading for it to be a buffer since that is where the API will be writing into, but thought that for writing it wasn't really a buffer you fill, but instead just data that you write which is why we had it like that. If we have an existing pattern in the framework, then we should use that instead.

from iot.

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.