Skip to content

Nim for TypeScript developers - async edition #15348

Open
@jonahsnider

Description

@jonahsnider

Summary

This is a documentation only issue.

The Nim for TypeScript Programmers is great but is currently missing information about the similarities between Nim's Futures and TypeScript/JavaScript's Promises, as well as how asynchronous functions behave.

Description

Here is a table I've compiled of Nim asyncfutures features and their respective JavaScript counterparts:

Nim TypeScript/JavaScript
Future[T] Promise<T>
newFuture[T] new Promise<T>()
complete Promise.resolve()
fail Promise.reject()
addCallback Promise.prototype.then()
`and` Promise.all()
`or` Promise.race()
all Promise.all()

Additional Information

The above information only mentions Promises, not any of the behavior with asynchronous functions, which do not behave identically to functions that return a Promise. I don't know enough about Nim's async pragma to write about that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationRelated to documentation content (not generation).EasyHacktoberfest (Open)Issues suitable for Hacktoberfest, open for working on.Javascript

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions