GithubHelp home page GithubHelp logo

nanoc's People

Contributors

kennethnym avatar

Watchers

 avatar

nanoc's Issues

Remove the need to specify field numbers in schema files

Currently, a field number must be explicitly assigned for every field in a message. The field numbers only indicate the order of the fields in the serialized bytes. For example, field number 0 appears first in the buffer, then field number 1, so on and so forth. Field numbers are needed because the YAML parser doesn't guarantee that the fields are traversed in the order they appear in the schema file, and the numbers are therefore used to give the compiler a consistent order across invocations.

In a7609e1, the YAML parser was downgraded to introduce the MapSlice struct that preserves the order of the fields as they appear in the schema file. This eliminates the need for explicit field numbers, which reduces noise in the schema file.

Auto infer type ID

Currently, a type ID must be explicitly specified for every NanoPack message in its schema. As the project grows, this will be completely unmaintainable. To mitigate this, the compiler should be able to:

  • automatically assign a new type ID for every new message defined; and
  • persist the assigned type IDs so that they are consistent for every compiler invocation.

To do so, the compiler should follow the following algorithm:

check whether the generated code for a schema exists
if it exists:
    read code header and check if a type ID is assigned
    if not exist:
        generate a new type ID
        write the type ID to the code header
else:
    generate a new type ID
    write the type ID to the code header

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.