This commit is contained in:
Chris Tsang 2021-06-19 21:30:52 +08:00
parent 564c6ed1a2
commit 8eaf7868c4
2 changed files with 24 additions and 24 deletions

View File

@ -1,6 +1,26 @@
# Readability
# Design Goals
## Turbofish and inference
1. Intuitive and ergonomic
API should state the intention clearly. Provide syntax sugar for common things.
2. Fast(er) compilation
Balance between compile-time checking and compilation speed.
3. Avoid 'symbol soup'
Avoid macros with DSL, use derive macros where appropriate. Be friendly with IDE tools.
## Test Time
After some bitterness we realized it is not possible to capture everything compile time. But we don't
want to encounter problems at run time either. The solution is to perform checking at 'test time' to
uncover problems. These checks will be removed at production so there will be no run time penalty.
## Readability
### Turbofish and inference
Consider the following method:
```rust
@ -31,7 +51,7 @@ then the Turbofish can be omitted:
```
provided that `fruit::Entity` is a unit struct.
## Builder pattern
### Builder pattern
Instead of:
```rust

View File

@ -35,24 +35,4 @@ Use mock connections to write unit tests for your logic.
4. API oriented
Quickly build search models that help you filter, sort and paginate data in APIs.
## Design Goals
1. Intuitive and ergonomic
API should state the intention clearly. Provide syntax sugar for common things.
2. Fast(er) compilation
Balance between compile-time checking and compilation speed.
3. Avoid 'symbol soup'
Avoid macros with DSL, use derive macros where appropriate. Be friendly with IDE tools.
## Test Time
After some bitterness we realized it is not possible to capture everything compile time. But we don't
want to encounter problems at run time either. The solution is to perform checking at 'test time' to
uncover problems. These checks will be removed at production so there will be no run time penalty.
Quickly build search models that help you join, filter, sort and paginate data in APIs.