Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 1.94 KB

2021-05-02.introducing-ghost-play.md

File metadata and controls

21 lines (14 loc) · 1.94 KB
title published excerpt
Introducing Ghost Play
true
It's important to remove barriers for anyone wishing to explore or adopt a new language. It can be a hassle to download and set up environments locally just to mess around with things. Today, we're happy to announce that we have the first version of Ghost Play online. No downloads or local environments necessary, just dive in and code immediately!

It's important to remove barriers for anyone wishing to explore or adopt a new language. It can be a hassle to download and set up environments locally just to dive in and play around with things. While we've made it easy to download Ghost for all major operating systems, we wanted to take it a step further.

Today we're excited to release the first version of Ghost Play, an online playground for Ghost that let's you explore and utilize the language with zero setup, directly in your browser.

Ghost Play

To achieve this, we've used Go to compile Ghost into WebAssembly (wasm), which can run directly in your browser on your local machine. With the wasm build, we're able to register new functions that can be called from Javascript directly. Currently, the wasm build includes a single function: ghost_run_code. With this single function, you can pass through a string of Ghost code and have it executed. It returns an array of two values: the result and returning object:

let {result, object} = ghost_run_code(`print('hello world!')`)

result is the resulting output of your program, e.g. results from things like print(). object is the returning object after evaluation, useful for insight into your code.

It's a really simple and elegant solution, and we'll get documentation written soon on its full implementation to allow anyone to embed ghost online. In the meantime be sure to check it out at play.ghostlang.org and let us know what you think!