dgkf / dgkf/R

Fall cleaning pass ideas :fallen_leaf: :broom:

Open
#170 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
145
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Just documenting a few cleanup ideas to give an opportunity for input before I embark on a few cleanup passes:

- [x] Convert `lazy_static!` to `OnceCell`
- [x] Improve how formal arguments are defined, planning something like to derive formal arguments for primitive functions as well as the `Sym` class for the builtin symbol.
As a `macro_rules!` macro, it could look something like
```rust
formals! { PrimitivePaste, "..., sep = ' ', collapse = NULL" }
```
This feels a bit clunky to me - especially if it would implement a trait. That definitely feels like something a proc macro should do.
```rust
#[builtin("paste(..., sep = ' ', collapse = NULL)")]
pub struct PrimitivePaste {}
```
Probably requires that the `r_derive` proc macro crate is able to use the parsing component from the core language in order to parse this, which would mean...
- [ ] Break up crate into separate crates as a workspace
- [x] Want to do a clean-up pass on macros, removing anything that isn't widely used and standardizing the few that are.
- [ ] Would like to explore ways to reduce the number of flavors of `call_*` and `eval_*`, etc that fuse things like argument matching, calling, evaluation and finalizing. Preferred outcomes would be an API that composes more nicely so that these behaviors can be built instead of individually handled:
```diff
- stack.eval_and_finalize(expr)
+ stack.eval(expr).finalize()
```
This would require that `EvalResult`s carry a reference to the `CallStack`
- [ ] Clean up `Context` implementations, as there is a lot of code lingering in the `Environment` implementation that is never called

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.