rokucommunity / rokucommunity/brighterscript

support await keyword

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

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
208
Forks
68
Avg merge
8h 39m
Merged PRs (30d)
39

Description

I propose that we support async/await semantics in brighterscript.

example:

      private async function login()
        m.account = await m.getAccount(m.nameInput.text, m.passwordInput.text
        if m.account
          m.username.label.text = m.account.name
        else
          m.username.label.text = "ERROR"
        end if
     end function

    private async function getAccount(name as string, password as string)
      token = await m.getToken(name, password)
      user = await m.getUserAccount(token)
      return user <> invalid ? user.account : invalid
    end function

    private async function getToken(name as string, password as string)
      'returns a promise, as per roku-promise (i.e a creates a task with an out field)
      'e.g.
      task = createObject("roSGNode", "UserTask")
      task.command = "getToken"
      task.name = name
      task.password = password
      task.control = "RUN"
      return task
    end function

    private async function getUserAccount(token as string)
      'returns a promise, as per roku-promise (i.e a task with an out field)
      task = createObject("roSGNOde", "UserTask")
      task.command = "getAccount"
      task.token = token
      task.control = "RUN"
      return task
    end function

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

The issue names no files, tests, or entry points. Start by clarifying the intended async/await semantics and how the proposed task-based promises should behave; done would require an agreed design, implementation, and coverage for the shown examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.