Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Using code-generation to generate  #70

Copy link
Copy link
@nkallen

Description

@nkallen
Issue body actions

I have made some breaking API changes on my branch. This is a WIP, but I'm showing early to get feedback early.

nkallen@458e080

I'm investigating code generation instead of manually writing bindings libgit2. This branch code-gen's an easy class, GitOid, from a JSON description of the libgit2 interface. The JSON is based on the data from here, http://libgit2.github.com/libgit2/v0.18.0.json, but highly modified

IN THEORY you just mark methods as "async", "prototype", "constructor", etc. and it will "just work". It works for GitOid, all tests pass.

The new interface for the raw Oid is what I described:

var oid = git.raw.Oid.fromString("SHA1")
oid.sha() = ...

This API change has repercussions, changing some APIs to sync from async, as in Commit. ATM, the API is inconsistent, as Reference's sha() method is still async, because of indirect references. However, I propose to change the api to have have an IndirectReference class and a DirectReference class, with IndirectReference only having a resolve() method, and sha() being synchronous on DirectReference.

It is no longer possible to construct a raw Oid from scratch, as it would be in an invalid state; and further objects are now immutable.

Along the way I've identified what I believe to be memory leaks. I'm hoping to have the code-gen produce code without these leaks, if they are indeed real.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.