Skip to content

Commit b0260ec

Browse files
doc: recommend Go version instead of the C++ version
Fixes #853
1 parent 52ce23a commit b0260ec

File tree

2 files changed

+13
-49
lines changed

2 files changed

+13
-49
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
For an introduction to Jsonnet and documentation,
66
[visit our website](https://jsonnet.org).
77

8-
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.
8+
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.
99

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

12+
**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.
13+
1214
## Packages
1315

1416
Jsonnet is available on Homebrew:

doc/learning/getting_started.html

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ <h3 id="stream">YAML Stream Output</h3>
274274
<div class="hgroup">
275275
<div class="hgroup-inline">
276276
<div class="panel">
277-
<h2 id="cpp-or-go">C++ or Go?</h2>
277+
<h2 id="cpp-or-go">C++, Go, or others?</h2>
278278
</div>
279279
<div style="clear: both"></div>
280280
</div>
@@ -284,58 +284,20 @@ <h2 id="cpp-or-go">C++ or Go?</h2>
284284
<div class="hgroup-inline">
285285
<div class="panel">
286286
<p>
287-
There are two feature-compatible implementations of the Jsonnet interpreter. The first one
288-
we built was the C++ interpreter, and it is still the most mature / widely used. The new Go
289-
implementation has the benefits of simpler code (due to leveraging goroutines and the GO
290-
garbage collector). Our long term plan is to migrate everyone to the Go implementation
291-
eventually. Both implementations are tested against the same test suite (which is quite
292-
thorough). Please report any deviations. The performance of the C++ implementation is
293-
currently a bit better, but for most people this should not be a factor and we're intending
294-
to address it over time, anyway.
287+
There are multiple implementations of the Jsonnet interpreter. The original interpreter was
288+
written in C++. However, there is a newer implementation written in Go, and this generally
289+
has better performance, as well as the benefits of being written in a memory safe language.
290+
The Go implementation also includes a linter, which is not available in the C++ implementation.
291+
Both the C++ and Go versions are tested against the same test suite.
295292
</p>
296293
<p>
297-
Another factor is that the formatter is currently only implemented in the C++ repo, and the
298-
linter is only implemented in the Go repo.
294+
Beyond the 'official' C++ and Go implementations, there are also various implementations written
295+
independently by other people, such as Rust and Haskell implementations, along with language
296+
bindings / wrappers for some other languages (such as PHP, and JavaScript).
297+
These are listed on the <a href="/ref/bindings.html#third_party_apis">Bindings</a> page.
299298
</p>
300299
</div>
301300
<div style="clear: both"></div>
302301
</div>
303302
</div>
304303

305-
306-
<div class="hgroup">
307-
<div class="hgroup-inline">
308-
<div class="panel">
309-
<h2 id="javascript">JavaScript</h2>
310-
</div>
311-
<div style="clear: both"></div>
312-
</div>
313-
</div>
314-
315-
<div class="hgroup">
316-
<div class="hgroup-inline">
317-
<div class="panel">
318-
<p>
319-
The C++ implementation can be compiled with <a
320-
href="https://emscripten.org/">emscripten</a> to produce a JavaScript
321-
implementation of Jsonnet. This is how we implement the interactive demos on this site. A
322-
native implementation of Jsonnet in JavaScript would probably be faster. In fact, a
323-
GopherJs transpile of the Go Jsonnet implementation may work better as well. However, the
324-
emscripten version is easy to build, and is sufficient for many purposes.
325-
</p>
326-
327-
<p>
328-
To compile it, first <a
329-
href="https://emscripten.org/docs/getting_started/downloads.html">install
330-
</a> emscripten and ensure em++ and emcc are in your path. Then make libjsonnet.js.
331-
</p>
332-
333-
<p>
334-
An unofficial <a href="https://github.com/yosuke-furukawa/node-jsonnet">nodejs package</a>
335-
of Jsonnet is also available.
336-
</p>
337-
338-
</div>
339-
<div style="clear: both"></div>
340-
</div>
341-
</div>

0 commit comments

Comments
 (0)