Skip to content

Documentation updates #1247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
For an introduction to Jsonnet and documentation,
[visit our website](https://jsonnet.org).

This repository contains the original implementation. You can also try [go-jsonnet](https://github.com/google/go-jsonnet), a newer implementation which in some cases is orders of magnitude faster.
This repository contains the original implementation. You can also try [go-jsonnet](https://github.com/google/go-jsonnet), a newer implementation which in some cases is orders of magnitude faster, and is recommended in preference to the C++ version.

Visit our [discussion forum](https://groups.google.com/g/jsonnet).

**Security note:** If you need to process *untrusted inputs* (untrusted Jsonnet code), it is best not to use the C++ implementation, as it is not hardened for that use-case. The expected use-case is for evaluating Jsonnet code that you / your organisation has written and trusts not to be malicious.

## Packages

Jsonnet is available on Homebrew:
Expand Down
5 changes: 2 additions & 3 deletions doc/articles/fractal.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ <h2 id=app>Example Web Application</h2>
The example application allows the user to zoom and pan a Mandelbrot fractal (dynamically
rendered server side, in C++). The user is able to save the location of features they find,
deep in the fractal, and a time-ordered list of these with thumbnails is displayed in the
left hand pane. The application is provisionally hosted <a
href="http://www.fractaldemo.com/">here</a>, but you can easily deploy your own as all
required files are available in the Jsonnet repository.
left hand pane. All required files are available in the Jsonnet repository if you want to
deploy this yourself.
</p>
<p>
Although admittedly a little contrived, this example is intended to represent the structure
Expand Down
58 changes: 10 additions & 48 deletions doc/learning/getting_started.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ <h3 id="stream">YAML Stream Output</h3>
<div class="hgroup">
<div class="hgroup-inline">
<div class="panel">
<h2 id="cpp-or-go">C++ or Go?</h2>
<h2 id="cpp-or-go">C++, Go, or others?</h2>
</div>
<div style="clear: both"></div>
</div>
Expand All @@ -284,58 +284,20 @@ <h2 id="cpp-or-go">C++ or Go?</h2>
<div class="hgroup-inline">
<div class="panel">
<p>
There are two feature-compatible implementations of the Jsonnet interpreter. The first one
we built was the C++ interpreter, and it is still the most mature / widely used. The new Go
implementation has the benefits of simpler code (due to leveraging goroutines and the GO
garbage collector). Our long term plan is to migrate everyone to the Go implementation
eventually. Both implementations are tested against the same test suite (which is quite
thorough). Please report any deviations. The performance of the C++ implementation is
currently a bit better, but for most people this should not be a factor and we're intending
to address it over time, anyway.
There are multiple implementations of the Jsonnet interpreter. The original interpreter was
written in C++. However, there is a newer implementation written in Go, and this generally
has better performance, as well as the benefits of being written in a memory safe language.
The Go implementation also includes a linter, which is not available in the C++ implementation.
Both the C++ and Go versions are tested against the same test suite.
</p>
<p>
Another factor is that the formatter is currently only implemented in the C++ repo, and the
linter is only implemented in the Go repo.
Beyond the 'official' C++ and Go implementations, there are also various implementations written
independently by other people, such as Rust and Haskell implementations, along with language
bindings / wrappers for some other languages (such as PHP, and JavaScript).
These are listed on the <a href="/ref/bindings.html#third_party_apis">Bindings</a> page.
</p>
</div>
<div style="clear: both"></div>
</div>
</div>


<div class="hgroup">
<div class="hgroup-inline">
<div class="panel">
<h2 id="javascript">JavaScript</h2>
</div>
<div style="clear: both"></div>
</div>
</div>

<div class="hgroup">
<div class="hgroup-inline">
<div class="panel">
<p>
The C++ implementation can be compiled with <a
href="https://emscripten.org/">emscripten</a> to produce a JavaScript
implementation of Jsonnet. This is how we implement the interactive demos on this site. A
native implementation of Jsonnet in JavaScript would probably be faster. In fact, a
GopherJs transpile of the Go Jsonnet implementation may work better as well. However, the
emscripten version is easy to build, and is sufficient for many purposes.
</p>

<p>
To compile it, first <a
href="https://emscripten.org/docs/getting_started/downloads.html">install
</a> emscripten and ensure em++ and emcc are in your path. Then make libjsonnet.js.
</p>

<p>
An unofficial <a href="https://github.com/yosuke-furukawa/node-jsonnet">nodejs package</a>
of Jsonnet is also available.
</p>

</div>
<div style="clear: both"></div>
</div>
</div>