LivelyKernel / LivelyKernel/lively4-core

Allow await on top level in Workspace

Open
#97 1 comment 0 reactions 0 assignees View on GitHub
comp: transpilation effort3: hard (weeks) P3: important type: feature
Dominant language
JavaScript
Stars
89
Forks
25
PR merge metrics
No merged PRs in 30d

Description

Currently, we cannot use `await` to wait for Promises in Workspaces (e.g. when `fetch`ing a resource).

To fix this: Update source code transformation to allow for top-level `await` statements.

When alternating the source code transformation, we have to consider the following:

- Arrange the order to move imports to the top of the file.
- Enclose all other statements in an asyncronous iife.
- the function should return a `do`-expression over all moved statements to provide the last evaluated statement as result
- take care of top-level variables, that still need to be recorded

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the Workspace source-code transformation entry point; the issue does not name a file or test. Trace how imports, top-level variables, and the final evaluated statement are currently handled before assessing the asynchronous IIFE and do-expression requirements. Done means Workspace code can use top-level await while imports remain first, variables are recorded, and the final statement remains the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.