lilactown / lilactown/harmony

Implement "defer"

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Implement a `defer` function which allows side effects to be run on successful commit of a transaction.

Example:

```javascript
let counter = ref(0);
branch().add(() => {
set(counter, 1);
let capturedCounter = deref(counter);
defer(() => {
console.log("Captured: ", capturedCounter);
console.log("Global: ", deref(counter));
});
}).add(() => {
alter(counter, n => n + 1); // increment the counter, setting it to two
}).commit();

// Logs out:
// "Captured: 1"
// "Global: 2"
```

`defer`red functions should be queued, and run in a stable order. TBD FIFO or LIFO.

Contributor guide

No contributing guide indexed for this repository

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

No files or tests are named; start by tracing the transaction commit path referenced in the example. Define the callback queue and resolve whether stable ordering is FIFO or LIFO, then verify that deferred functions run only after a successful commit and observe the captured and final values shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.