Coder Social home page Coder Social logo

buffet's People

Contributors

dinosaure avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

drup

buffet's Issues

Talk about interface

Idea behind buffet is to provide a safe interface to manipulate buffer (string, bytes and bigstring). buffet has different levels about interface:

  • Buffet0 this is the foundation for the next level, it's just a bunch of external, bigstringaf and nothing else. We provide getter and setter on char, int, int32 and int64 (little-endian and big-endian) like what bigstringaf does already.
  • Buffet1: we start with a GADT to keep kind of buffer. We merge all on a type 'kind tag type which is used to dispatch functions to the good implementation. Buffet1.get bytes will call Bytes.get.
  • Buffet2: we continue with a GADT but put some information like if we have a read, write or async (leave the global lock) capability on one of kinds of buffer. Limitation on GADT can not permit us to use a sub-typing (like we do in a common way with polymorphic variant). In this implementation, we lint some pattern-matching like the dispatcher on the set/unsafe_set function which don't allow a String kind for example.
  • Buffet3: we put a new information, an offset and a length with type ('a, 'k) Buffet1.access which check at any step if slice is available on the buffer 'k. I decided to return a result type, Ok if we have an access on the buffer 'k with a specific slice or an error, you can see the function commit or with_off and with_len with the bind operator >>=.
  • Buffet4: again, a GADT to hidden/pack type ('a, 'k) Buffet3.meta with 'k. Then, we check with GADT if we are allowed to read/write and so on on it with reflection. In other case, we raise an exception.

I'm currently on a new implementation of Buffet2 which use polymorphic variant. Then, we need to do some benchmark to compare them and see which is the best:

  • discard String case
  • or raise an exception

If you have any advise, I will happy to discuss about that (@hannesm, @samoht, @cfcs, @let-def, @Drup).

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.