Skip to content

Break up Memo trait #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

connortsui20
Copy link
Member

Problem

The memo trait was way too large.

Summary of changes

This PR breaks up the Memo table into 4 subtraits. See src/memo/traits.rs for more info.

connortsui20 and others added 5 commits May 2, 2025 13:03
## Problem

If we want users of the DSL to add their own UDFs, it makes more sense
to have them recompile just the CLI with their functions rather than the
entirety of `optd`.

## Summary of changes

Extracts the `cli` module into its own crate.

Ideally we figure out how to let users of the CLI add their own UDFs in
an ergonomic way without having to fork our repository. This should be
easy (could either use a proc macro or expose more of the compilation
functions as building blocks in a library), and can be left to a later
point in time.
Supports generic bounds in the type system.
Partially tackles #81 .

```
fn <K: EqHash, V> (pairs: [(K, V)]) to_map(): {K: V} = match pairs
| [head .. tail] -> {head#_0: head#_1} ++ tail.to_map()
\ [] -> {}
```

Also removed the `None` type, as it was really just an
`Option<Nothing>`. This creates some issues when comparing an option
with `None`. I need to see what can be done to fix that small bug.
## Overview

DSL functions can now be executed through the CLI with the `[run]`
annotation.

Try it out!

`cargo run --bin optd-cli -- run-functions [path]/logical_rules.opt`

## Known Issues

- Stack overflows *very* quickly due to the lack of TCO in the engine.
Needs to be optimized.
- Existing type inference issues.
As title, also refactored the annotation checking process.
@AlSchlo
Copy link
Collaborator

AlSchlo commented May 10, 2025

Work integrated into #101

@AlSchlo AlSchlo closed this May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants