posit-dev / posit-dev/ark

Add support for NSE functions and semantic effects

Open
#1,338 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: language server
Dominant language
Rust
Stars
337
Forks
32
Avg merge
8d 17h
Merged PRs (30d)
11

Description

Most important effect to support: evaluation in a nested scope (e.g. test_that()). Definitions in a nested scope shouldn't escape.

Other effects to support soon:

  • Attach (library(), require())
  • Source
  • Assign (S7's :=, magrittr's %<>%, base::delayedAssign(), etc)
  • Quote (quote(), bquote()), including unquoted holes with e.g. .(arg) or !!arg

Effects for later:

  • Eval (to be done a bit later because this requires data flow to be useful)
  • ExprCapture (substitute())
  • EnvCapture (new.env(), parent.frame(), environment())

Not straightforward because these effects can interact with each other, e.g. a Source may hide effects, a nested NSE scope may cause an effect to be masked, or on the contrary may prevent an effect to be masked, etc. Main idea: resolve effect linearly. Any effect in a lazy scope that contradicts a linear effect is an ambiguous program that should be linted.

All these effects should be expressible with either:

  • Local declarations with declare(), which requires a mini language spec for describing these effects

  • Custom Rust handlers vendored in Oak. Many functions have complex effects depending on arguments and trying to express these with a DSL is a lost cause. We'll provide support for argument matching, static resolution of values, etc.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by studying the proposed effects for nested evaluation, attach, source, assign, quote, and later eval or environment capture. The issue points to declare() and custom Rust handlers vendored in Oak as the implementation entry points, but names no files or tests. Done means these effects can be represented and their interactions, including ambiguous lazy versus linear effects, can be linted.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.