Git Product home page Git Product logo

Comments (7)

seliopou avatar seliopou commented on September 28, 2024

This will definitely be included before Faraday's initial release. It'd be helpful to know what, if any, problems you were trying to solve when you came across the library, and your expectations as to how the library would fit into your solution. For example, it's unclear to me if your expectation was that Faraday would offer a serialization format, or that it would just offer a data structure that would allow you to target a serialization format efficiently. Knowing these sorts of things would be a tremendous help while writing documentation, as it would help me refine the mental model of the user I'm targeting. Thanks!

from faraday.

lindig avatar lindig commented on September 28, 2024

From the repository's summary Serialization library built for speed and memory efficiency I was expecting a library to serialise (i.e. read and write) data - in particular user-defined and complex values. Maybe I'm misunderstanding the concept of serialisation.

from faraday.

seliopou avatar seliopou commented on September 28, 2024

Usually serialization refers to converting an in-memory object into a representation that's suitable for storage or transmission. In other words, the writing part. For the reading part, angstrom is a library that's well-suited to that use case.

I'm still not clear on what your expectation was. Is it that Faraday would prescribe a particular serialization format for user-defined data types? Honest question.

from faraday.

lindig avatar lindig commented on September 28, 2024

A parser takes a byte stream and creates a data structure representing the abstract objects represented by that byte stream. I expect a serialiser to do the opposite. Say, I have a record representing time and date, I would expect support from a serialisation library to create a byte stream from it. Look at any JSON library: it provides a way to map data structures to JSON syntax. My expectation is that Faraday does something similar, but more efficient.

I fear we are talking past each other. So maybe you could suggest a scenario where I would want to use Faraday.

from faraday.

seliopou avatar seliopou commented on September 28, 2024

Not at all, this back and forth has been helpful and will inform how I document Faraday.

To answer your question directly, you would use Faraday to write the JSON serializer, or the serializer the record that contains a time and a date, or whatever complex, user-defined type that an application is dealing with. So a user of Faraday needs to bring with him a data type to serialize, together with a serialization format, and then use the library to implement the serializer for the data type that targets the serialization format. (Functionality like that contained in the Marshal module, for example, is not a goal of the library.) A user can use the write_* calls to perform copies into an internal buffer, or schedule_* calls to add buffers directly to the output without performing a copy. In the case of a schedule_* call, the buffer should not be modified until flush succeeds. In that way, you can control the allocation and copy behavior of your serializer while generating output that's suitable for vectorized write operations, e.g., writev(2). See the operation type for details about that.

Does that clarify things? If there's a better way to communicate this, then I'd be thankful for the notes.

from faraday.

lindig avatar lindig commented on September 28, 2024

Yes. The way I understand it now, Faraday does provide serialisation of the base types but (so far) not for sum and product types. It would be my own job to map a binary tree value to the primitives provided by Faraday.

from faraday.

seliopou avatar seliopou commented on September 28, 2024

I've included a JSON serializer in the examples subdirectory of the project, as well as a simpler example of serializing abstract syntax tree of a simple arithmetic expression language in the README. Those, together with an updated description of the library, should hopefully clarify the purpose and uses of faraday.

from faraday.

Related Issues (12)

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.