Commit 211bdd9d authored by Kenton Varda's avatar Kenton Varda

More doc updates.

parent 7fbaeb4d
......@@ -3,7 +3,7 @@
<div class="hmargin" style="float: right"><a class="groups_link" style="color: #fff"
href="https://groups.google.com/group/capnproto-announce">Stay Updated</a></div>
<h1>News</h1>
<h1><a href="/news/">News</a></h1>
<h2>{{ page.title }}</h2>
<p class="author">
......
......@@ -542,6 +542,10 @@ Notes about the dynamic API:
and even enum types and `DynamicEnum`. Finally, all valid Cap'n Proto field types may be
implicitly converted to `DynamicValue`.
* You can load schemas dynamically at runtime using `SchemaLoader` (`capnp/schema-loader.h`) and
use the Dynamic API to manipulate objects of these types. `MessageBuilder` and `MessageReader`
have methods for accessing the message root using a dynamic schema.
* Unlike with Protobufs, there is no "global registry" of compiled-in types. To get the schema
for a compiled-in type, use `capnp::Schema::from<MyType>()`.
......
......@@ -78,11 +78,10 @@ I no longer work for Google. Cap'n Proto is not affiliated with Google or any ot
**_OK, how do I get started?_**
At this time, Cap'n Proto is not ready for production use. Feel free to
[play around with the code and run the benchmarks](install.html), but note that it's incomplete
and buggy. If you'd like to help hack on Cap'n Proto, such as by writing bindings in other
languages, let us know on the [discussion group](https://groups.google.com/group/capnproto). If
you'd just like to know when it's ready, add yourself to the
To install Cap'n Proto, head over to the [installation page](install.html). If you'd like to help
hack on Cap'n Proto, such as by writing bindings in other languages, let us know on the
[discussion group](https://groups.google.com/group/capnproto). If you'd like to receive e-mail
udpates about future releases, add yourself to the
[announcement list](https://groups.google.com/group/capnproto-announce).
{% include buttons.html %}
......@@ -13,9 +13,9 @@ As of this writing, Cap'n Proto is in beta. The serialization layer is close to
and we don't anticipate any further changes to the wire format. That said, if you want to use it,
you should keep in mind some caveats:
* **Security:** Although Kenton has some background in security, there are almost certainly a few
exploitable security bugs in the Cap'n Proto code. You should not use Cap'n Proto on untrusted
data until a proper security review has been completed.
* **Security:** Cap'n Proto has not yet had a security review. Although Kenton has a background
in security and is not aware of any vulnerabilities in the current code, it's likely that there
are a few. For now, do not accept Cap'n Proto messages from parties you do not trust.
* **API Stability:** The Cap'n Proto programming interface may still change in ways that break
existing code. Such changes are likely to be minor and should not affect the wire format.
* **Performance:** While Cap'n Proto is inherently fast by design, the implementation has not yet
......@@ -42,8 +42,8 @@ First, install [Cabal](http://www.haskell.org/cabal/), e.g. on Ubuntu:
Now you can download and install the release tarball:
curl -O [TODO: URL]
cabal install capnproto-compiler-0.1.0.tar.gz
<pre><code>curl -O <a href="http://capnproto.org/capnproto-compiler-0.1.0.tar.gz">http://capnproto.org/capnproto-compiler-0.1.0.tar.gz</a>
cabal install capnproto-compiler-0.1.0.tar.gz</code></pre>
Be sure that the Cabal bin directory (e.g. `$HOME/.cabal/bin` on Ubuntu or
`$HOME/Library/Haskell/bin` on Mac OSX) is in your `PATH` before you attempt to build the C++
......@@ -114,12 +114,12 @@ from Git, you must install the runtime from Git.
You may download and install the release version of the C++ runtime like so:
curl -O [TODO: URL]
tar zxvf capnproto-c++-0.1.0.tar.gz
cd capnproto-c++-0.1.0
./configure
make -j6 check
sudo make install
<pre><code>curl -O <a href="http://capnproto.org/capnproto-c++-0.1.0.tar.gz">http://capnproto.org/capnproto-c++-0.1.0.tar.gz</a>
tar zxf capnproto-c++-0.1.0.tar.gz
cd capnproto-c++-0.1.0
./configure
make -j6 check
sudo make install</code></pre>
This will install `libcapnp` in `/usr/local/lib` and headers in `/usr/local/include/capnp` and
`/usr/local/include/kj`.
......
......@@ -2,7 +2,7 @@
layout: page
---
# Defining Types
# Schema Language
Like Protocol Buffers and Thrift (but unlike JSON or MessagePack), Cap'n Proto messages are
strongly-typed and not self-describing. You must define your message structure in a special
......
......@@ -40,11 +40,11 @@ The Cap'n Proto compiler / code generator binary, `capnpc`, supports a "plugin"
custom code generators. Plugins are independent executables (written in any language) which read
a description of the schema from standard input and then generate the necessary code. The
description is itself a Cap'n Proto message, defined by
[schema.capnp](https://github.com/kentonv/capnproto/blob/master/c%2B%2B/src/capnproto/schema.capnp)
(the file will move to a better location eventually). Specifically, the plugin receives a
`CodeGeneratorRequest`, using
[schema.capnp](https://github.com/kentonv/capnproto/blob/master/c%2B%2B/src/capnp/schema.capnp).
Specifically, the plugin receives a `CodeGeneratorRequest`, using
[standard serialization](http://kentonv.github.io/capnproto/encoding.html#serialization_over_a_stream)
(not packed).
(not packed). (Note that installing the C++ runtime causes schema.capnp to be placed in
`$PREFIX/include/capnp` -- `/usr/local/include/capnp` by default).
Of course, because the input to a plugin is itself in Cap'n Proto format, if you write your
plugin directly in the language you wish to support, you may have a bootstrapping problem: you
......@@ -69,3 +69,23 @@ as the working directory, so you do not need to worry about this.
[This example plugin](https://github.com/kentonv/capnproto/blob/master/c%2B%2B/src/capnp/compiler/capnpc-capnp.c%2B%2B)
writes the schema back to standard output in Cap'n Proto schema language, similar to what
`capnpc -v` does.
### Supporting Dynamic Languages
Dynamic languages have no compile step. This makes it difficult to work `capnpc` into the workflow
for such languages. Additionally, dynamic languages are often scripting languages that do not
support pointer arithmetic or any reasonably-performant alternative.
Fortunately, dynamic languages usually have facilities for calling native code. The best way to
support Cap'n Proto in a dynamic language, then, is to wrap the C++ library, in particular the
[C++ dynamic API](cxx.html#dynamic_reflection). This way you get reasonable performance while
still avoiding the need to generate any code specific to each schema.
Of course, you still need to parse the schema. As of v0.1, the C++ runtime only has the ability
to load schemas that have already been parsed and translated to a binary format (defined by
`schema.capnp`, the same format used by compiler plugins). It cannot parse `.capnp` files directly.
In a future version of Cap'n Proto, the schema parser will be rewritten from Haskell to C++ to
solve this problem. For now, you can hack around it by invoking `capnpc` as a subprocess. Running
`capnpc -o/bin/cat myschema.capnp`, for example, will cause `capnpc` to invoke `cat` as if it were
a compiler plugin causing the compiled schemas to be written back to stdout, from which your calling
process can parse and load them.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment