Skip to content
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

feat: implement the standard library numeric functions. #251

Merged
merged 4 commits into from
Nov 12, 2024

Conversation

peterhuene
Copy link
Collaborator

@peterhuene peterhuene commented Nov 12, 2024

This PR implements call expressions for the following standard library
functions:

  • floor
  • ceil
  • round
  • min
  • max

Additionally, this PR refactors binding functions in wdl-analysis to provide
more information to allow for dispatching the call to the implementation in
wdl-engine.

One of the bigger changes is that the minimum WDL version specification
for functions has moved from the function itself to the signatures; this
means that future versions of WDL can add a new overload to an existing
function and the new signature will not be included in the overload set
when evaluating for a previous version of WDL.

Before submitting this PR, please make sure:

  • You have added a few sentences describing the PR here.
  • You have added yourself or the appropriate individual as the assignee.
  • You have added at least one relevant code reviewer to the PR.
  • Your code builds clean without any errors or warnings.
  • You have added tests (when appropriate).
  • You have updated the README or other documentation to account for these
    changes (when appropriate).
  • You have added an entry to the relevant CHANGELOG.md (see
    "keep a changelog" for more information).
  • Your commit messages follow the conventional commit style.

Previously, only the calculated return type was returned from `Function::bind`.

This change adds both the overload index and the bound function signature are
returned as well.

The index can then be used to statically dispatch the call in expression
evaluation.

Additionally, the minimum version has moved from being specified on the
function to each individual signature.

This will allow the standard to add overloads for existing functions in the
future.
This commit implements call expressions for the following standard library
functions:

* `floor`
* `ceil`
* `round`
* `min`
* `max`

Included with this change is a refactoring to how we evaluate call expressions
in both analysis and the engine; this refactoring prevents an allocation in
analysis and fixes a bug in the engine where the number of arguments to the
function exceeded `MAX_PARAMETERS` and caused a panic.
@peterhuene peterhuene merged commit 4d16b8b into stjude-rust-labs:main Nov 12, 2024
16 checks passed
@peterhuene peterhuene deleted the stdlib branch November 12, 2024 20:18
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