Git Product home page Git Product logo

jsonnet's People

Contributors

benley avatar camh- avatar cdluminate avatar davidzchen avatar deepgoel17 avatar dmuir-g avatar duologic avatar gburiola avatar hanazuki avatar hanyucui avatar johnbartholomew avatar ketchupbomb avatar loverszhaokai avatar mikedanese avatar mortenmj avatar oconnorr avatar osher avatar podsvirov avatar redbaron avatar refi64 avatar rhowe avatar rohitjangid avatar sbarzowski avatar scr-oath avatar sparkprime avatar spencels avatar tejesh-raut avatar timp87 avatar toge avatar yegle avatar

Stargazers

 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  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

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  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

jsonnet's Issues

Importing from URLs

It may be useful to import from a URL, or otherwise contact an external service. The current semantics would be a special case of this, i.e. file://path.

It is not clear whether the request should be parameterizable.

Either way, Jsonnet will still cache the result of fetching the URL to enforce referential transparency.

Need to bound execution time

It is currently possible to write programs that run for a long time, such as computing the Ackerman function. This is bad news if Jsonnet is integrated into a server, where such programs will use excess CPU resources and block other users.

Jsonnet should count the number of loops around the VM, and bound it either in number of instructions, or in time by calling the time syscall every 1000 instructions (or whatever).

Python 3.x Compatibility

I forked and converted to use Visual Studio, and I also changed support from Python 2 C API to Python 3.4 API. It wasn't horribly difficult to do either task, but the project is there for anybody who needs or wants it.

Add a system for searching for libraries from a path.

Jsonnet would hardcode some paths

/usr/share/jsonnet
/usr/local/share/jsonnet

You would also be able to add additional search directories with a JSONNET_PATH environment variable.

Perhaps the hardcoded paths would have version numbers in them.

test/error.import_folder.jsonnet has different output depending on OS

Runtime platform OSX 10.10.3:

# ../jsonnet --gc-min-objects 1 --gc-growth-trigger 1 error.import_folder.jsonnet
STATIC ERROR: lib:1:1: Unexpected end of file.

this error is different from the linux runtime error, https://github.com/google/jsonnet/blob/master/test_suite/error.import_empty.jsonnet.golden
so the test fails.

Suggested fix to work on multiple OS platforms might be to insert platform name (eg error.import_folder.jsonnet.darwin.golden) and test for existence of a platform-specific file within run_tests.sh.

Please support ES6 back-tick for strings

ES6 has some wonderful functionality based on strings wrapped in the back-tick (`) instead of the standard double-quote (") and single-quote (') characters.

Please, PLEASE add full support for the ES6 back-tick functionality!

More expressive comprehension syntax.

Currently, list comprehension only supports a single 'for' and a single 'if'. In Python, an unlimited number of these can be specified, and they can be interleaved arbitrarily. Consider extending Jsonnet to be equally expressive.

Import file as a string

It would be good to have an import_as_string construct that behaves similarly to import "foo.jsonnet" but instead yields the contents of a file as an uninterpreted string. This would be useful for embedding bash scripts, for example.

Make include guards unique

I find that include guards like "AST_H" and "VM_H" are too short for the safe reuse of your header files (when they belong to an application programming interface).

Add a date library

Code to convert to/from tuples like {year: x, month:x, ... seconds: x } into textual / other structured representations (seconds since epoch, etc).

Need to trap and redirect the implementation of the import construct

There are contexts where allowing Jsonnet programs to access the file system is inappropriate, for example when a server executes code provided by a user. In those cases, it may still make sense for the import keyword to do something useful, but the service that is using the Jsonnet library needs to provide some sort of callback to handle the import construct in that case.

Jsonnet will still cache the result of the import to maintian referential transparency.

Optional fields

It would be good if a computed field name evaluated to null, rather than being a dynamic error, if that field was simply omitted from the object. For example

{
    x: 1,
    [if nighttime then "light_brightness" else null]: 100,
}

Will yield either {x: 1} or {x: 1, light_brightness: 100} depending on whether nighttime is true.

Cmdline flag to check two jsonnet files manifest equivalently

Evaluate both files and check JSON output is the same.

This is useful when refactoring to know whether or not the changes were purely internal (good) or had some external effect (bad).

E.g. if you're a vim user:

jsonnet --compare Foo.jsonnet Foo.jsonnet~

Can output a diff of the two JSON strings.

Conflicts with --multi.

Need to bound the memory use of Jsonnet evaluation

The interpreter currently knows how many objects are live, but not how large they are. If it had this extra information, it would be possible to place a bound on the amount of memory that can be used during execution. This makes it safer to run Jsonnet in a server environment.

Tail call optimization

The current implementations of foldl (and similar routines) rely on tail call recursion, but currently they blow the stack when operating on arrays that are too long. This can be fixed by optimizing tail calls to re-use their current stack frame.

I think an explicit construct for enabling the optimization is better than applying it for all tail calls, because then you preserve stack traces in the majority of cases where the optimization is not required.

Require unit test

I think it is better if there are unit tests, such as using gtest.

terminate called after throwing an instance of 'std::ios_base::failure'

$ ls folder
input.jsonnet
$ cat folder/input.jsonnet

import "" {
    cocktails +: {
        "Whiskey Sour": {
            ingredients: [
                { kind: "Scotch", qty: 1.5 },
                { kind: "Lemon Juice", qty: 0.75 },
            ],
            garnish: "Lemon Peel",
            served: "On The Rocks",
        }
    }
}

$ ../jsonnet folder/input.jsonnet
terminate called after throwing an instance of 'std::ios_base::failure'
what(): basic_filebuf::underflow error reading the file
Aborted

Add a REPL

For exploring Jsonnet, it would be nice to have a REPL, e.g., via jsonnet -i. For inspiration, I would look to Scala's REPL as an example.

Arbitrary precision rational arithmetic

Using double precision floating point has its flaws, e.g. rounding errors. It makes sense to use arbitrary precision rational arithmetic in Jsonnet. We will have to find a library with a decent license that does not bloat the binary size too much, and then replace the current number representation.

Support Unicode

Currently only ASCII is supported in strings. It should not be too hard to accept UTF-8 (raising an error for invalid input), and adjust internal string routines to support unparsing those strings correctly, as well as routines for iterating over codepoints, correctly determining the length (in codepoints), etc.

Add # comment syntax

The behavior is the same as //

The purpose is to allow "hash bang" lines at the top of the file, and also be consistent with other syntaxes such as Python and YAML.

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.