Giter Club home page Giter Club logo

bison-types's People

Contributors

anklos avatar deancouch avatar dependabot-preview[bot] avatar dependabot[bot] avatar freshtonic avatar greenkeeper[bot] avatar nguyenchr avatar rprieto avatar tbarker25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bison-types's Issues

Compile to JavaScript

To avoid the run-time dependency on CoffeeScript, we should compile this to JS at build-time.
We can base it on the Makefile from hyperactive.

Support for variable-length strings, and questions about encodings

The current utf-8 type only supports reading known-length strings. This might be confusing for people who just want to read and write any string. It's also error prone since the naive approach of writing {str.length}{str} does not work for UTF strings, since str.length can actually be smaller than the number of required bytes.

Any ideas?

Variable length strings

We should make it very clear in the README that the current types only work for known-length strings.

We could also introduce a varchar type (or similar) that automatically encodes the length as well. It needs to handle multi-bytes strings, for example using

tmp = new Buffer(str, 'utf-8')  # figure out the actual byte count in the given encoding
@buffer.writeUint8(tmp.length)
@buffer.writeString(str)

or be more efficient by using the return value of writeString and then going back to write the length.

Because we need to reserve space for the length, we could

  • always reserve 1 byte, and support strings up to 256 characters
  • have a flexible varchar(len) where len is the maximum string length in bytes, so we simply reserve len/256 bytes to store the length

Encoding

Once we figure that out, the next question is: should bison-types mirror clever-buffer and expose a raw string, in addition to more sub-types like utf-8, ascii, etc...? What does that look like with fixed-length / variable-length? Maybe varchar(20, 'utf-8')?

Going back then, does it make sense to have a matching fixchar(20, 'utf-8'), which reads a utf-8 string of 20 bytes?

Treat skip as an edge case

Reading a skip returns a value. Currently the offset of the buffer
Would be nice to not include an values that have been skipped in the resulting json object

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.