https://github.com/ben-ph/type_eval
Compile time evaluation crate.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.9%) to scientific vocabulary
Repository
Compile time evaluation crate.
Basic Info
- Host: GitHub
- Owner: Ben-PH
- License: apache-2.0
- Language: Rust
- Default Branch: main
- Size: 135 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
An R&D project that explores adding evaluation as a first-class-citizen to the typenum crate.
Typenum treats constant values and evaluation the way it ought to be treated:
- Unconcerned with machine representation (u64, usize, i32, etc)
- Specifications in the type-system (
fn foo<F: IsGreater<U8>()) - Compile-time and Execution-time code is explicitly separated
The shortfall of typenum, is that evaluation is not provided. The operation ((x + 4) * Y) / Z must be expressed like so:
``rust
fn thing<X, Y>()
where
X: Add<U4>,
op!(X + U4): Mul<Y>,
op!((X + U4) * Y): Div<Z>,
op!(((X + U4) * Y) / Z): Unsigned,
{
type ResHelper = op!(((X + U4) * Y) / Z);
println!("the value evaluated to {}", ResHelper::USIZE)
// UseResHelper` as the final type-system evaluation
}
fn main() {
thing::
```
This process of saying "the type-values passed in must be able to perform this arithmetic" is now done internally through the *Expr traits (Num/Bool/Ord/other expression traits):
```rust
fn thing
fn main() {
// todo: actually impl the op! macro:
// dothing::
Limitations
Currently negative numbers are not yet implemented.
The strategy for implementing division requires type-resolution capabilities made available in nightly-2024-10-17. This should be improved in the near future.
The following operations are implemented: if, +, -, *, /, <<, >>, <, >, <=, >=, ==, cmp
The error output is in a messy binary form. The plan is to make this more readable.
Future work
In very approximate order of priority:
- Runtime number expression
- Robust property/fuzz testing
- negative numbers
- Move from binary to decimal representation
- More readable errors
- implementation of an
opmacro (replaceIF<LT<X, Y>, Add<Div<X, U2>, Y>, Z>withop!(if X < Y {(X + 2)/ Y} else {Z})) - Explore use of
struct U238...instead oftype U238 = ... - Usable in place of a
usizetype in declaring array lengths. matchexpression impl- closure expression impl
- any-type expression (i.e. Bool/Num/Ord expressions all impl the generic expression)
- Upstreaming into a nursary/nightly feature.
Owner
- Name: Ben
- Login: Ben-PH
- Kind: user
- Location: Cornus, France
- Repositories: 2
- Profile: https://github.com/Ben-PH
A budding developer coming into early middle ages, a career change and new passions is what drives me.
GitHub Events
Total
- Issues event: 1
- Watch event: 1
- Delete event: 3
- Issue comment event: 2
- Member event: 1
- Push event: 47
- Pull request event: 38
- Create event: 23
Last Year
- Issues event: 1
- Watch event: 1
- Delete event: 3
- Issue comment event: 2
- Member event: 1
- Push event: 47
- Pull request event: 38
- Create event: 23
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 1
- Total pull requests: 22
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.05
- Merged pull requests: 20
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 22
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.05
- Merged pull requests: 20
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Ben-PH (2)
Pull Request Authors
- Ben-PH (38)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cargo 684 total
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
crates.io: type_eval
Type level evaluation and proof-carrying
- Documentation: https://docs.rs/type_eval/
- License: MIT OR Apache-2.0
-
Latest release: 0.0.1-alpha
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- bitvec 1.0.1
- funty 2.0.0
- radium 0.7.0
- tap 1.0.1
- wyz 0.5.1