Mike Gerwitz
be81878dd7
Also known as metavariables or template parameters. This is a bit of a tortured excursion, trying to figure out how I want to best represent this. I have a number of pages of hand-written notes that I'd like to distill over time, but the rendered graph ontology (via `asg-ontviz`) demonstrates the broad idea. `AirTpl::TplApply` highlights some remaining questions. What I had _wanted_ to do is to separate the concepts of application and expansion, and support partial application and such. But it's going to be too much work for now, when it isn't needed---partial application can be worked around by simply creating new templates and duplicating params, as we do today, although that sucks and is a maintenance issue. But I'd rather address that head-on in the future. So it's looking like Option B is going to be the approach for now, with templates being closed (as in, no free metavariables) and expanded at the same time. This simplifies the parser and error conditions significantly and makes it easier to utilize anonymous templates, since it'll still be the active context. My intent is to get at least the graph construction sorted out---not the actual expansion and binding yet---enough that I can use templates to represent parts of NIR that do not have proper graph representations or desugaring yet, so that I can spit them back out again in the `xmli` file and incrementally handle them. That was an option I had considered some months ago, but didn't want to entertain it at the time because I wasn't sure what doing so would look like; while it was an attractive approach since it pushes existing primitives into the template system (something I've wanted to do for years), I didn't want to potentially tank performance or compromise the design for it after I had spent so much effort on all of this so far. But my efforts have yielded a system that significantly exceeds my initial performance expectations, with a decent abstractions, and so this seems viable. DEV-13708 |
||
---|---|---|
.. | ||
benches | ||
build-aux | ||
src | ||
tests | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
Makefile.am | ||
README.md | ||
autogen.sh | ||
bootstrap | ||
conf.sh.in | ||
configure.ac | ||
rustfmt.toml |
README.md
TAME in Rust (TAMER)
TAME was written to help tame the complexity of developing comparative insurance rating systems. This project aims to tame the complexity and performance issues of TAME itself. TAMER is therefore more tame than TAME.
TAME was originally written in XSLT. For more information about the
project, see the parent README.md
.
Building
To bootstrap from the source repository, run ./bootstrap
.
To configure the build for your system, run ./configure
. To build, run
make
. To run tests, run make check
.
You may also invoke cargo
directly, which make
will do for you using
options provided to configure
.
Note that the default development build results in terrible runtime performance! See [#Build Flags][] below for instructions on how to generate a release binary.
Build Flags
The environment variable CARGO_BUILD_FLAGS
can be used to provide
additional arguments to cargo build
when invoked via make
. This can be
provided optionally during configure
and can be overridden when invoking
make
. For example:
# release build
$ ./configure && make CARGO_BUILD_FLAGS=--release
$ ./configure CARGO_BUILD_FLAGS=--release && make
# dev build
$ ./configure && make
$ ./configure CARGO_BUILD_FLAGS=--release && make CARGO_BUILD_FLAGS=
Hacking
This section contains advice for those developing TAMER.
Running Tests
Developers should be using test-driven development (TDD). make check
will
run all necessary tests.
Code Format
Rust provides rustfmt
that can automatically format code for you. This
project mandates its use and therefore eliminates personal preference in
code style (for better or worse).
Formatting checks are run during make check
and, on failure, will output
the diff that would be applied if you ran make fmt
(or make fix
); this
will run cargo fmt
for you (and will use the binaries configured via
configure
).
Since developers should be doing test-driven development (TDD) and therefore
should be running make check
frequently, the hope is that frequent
feedback on formatting issues will allow developers to quickly adjust their
habits to avoid triggering formatting errors at all.
If you want to automatically fix formatting errors and then run tests:
$ make fmt check
Benchmarking
Benchmarks serve two purposes: external integration tests (which are subject
to module visibility constraints) and actual benchmarking. To run
benchmarks, invoke make bench
.
Note that link-time optimizations (LTO) are performed on the binary for benchmarking so that its performance reflects release builds that will be used in production.
The configure
script will automatically detect whether the test
feature
is unstable (as it was as of the time of writing) and, if so, will
automatically fall back to invoking nightly (by running cargo +nightly bench
).
If you do not have nightly, run you install it via rustup install nightly
.