# How do you create Scheme objects on the Javascript side of Hoot?

**URL:** <https://community.spritely.institute/t/how-do-you-create-scheme-objects-on-the-javascript-side-of-hoot/812>\
**Category:** Uncategorized\
**Created:** [April 10, 2026, 2:50pm UTC](https://community.spritely.institute/t/how-do-you-create-scheme-objects-on-the-javascript-side-of-hoot/812 "2026-04-10T14:50:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kakafarm](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.spritely.institute/kakafarm/32/360_2.png) [@kakafarm](https://community.spritely.institute/u/kakafarm)\
**Post date:** [April 10, 2026, 2:50pm UTC](https://community.spritely.institute/t/how-do-you-create-scheme-objects-on-the-javascript-side-of-hoot/812/1 "2026-04-10T14:50:00Z")

</div>

I want to create Scheme objects in Javascript and store them in Javascript variables so that I may be able to read them on Hoot with a `(ref eq)` returning `define-foreign`. How do you go about doing that?

---

<div class="post-metadata">

**Author:** ![kakafarm](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.spritely.institute/kakafarm/32/360_2.png) [@kakafarm](https://community.spritely.institute/u/kakafarm)\
**Post date:** [April 11, 2026, 1:08pm UTC](https://community.spritely.institute/t/how-do-you-create-scheme-objects-on-the-javascript-side-of-hoot/812/2 "2026-04-11T13:08:49Z")

</div>

I don’t know what would `convertToScmValueHootCanRead` be, or if it even exists.

```javascript
let scm_globals = new Map();

// You can pack it up with some values:
scm_globals.set("cow", convertToScmValueHootCanRead("🐮"));

// in the Hoot FFI handlers:

{
  // ...
  globals: {
    readScmGlobals: (key) => scm_globals.get(key),
    setScmGlobals: (key, value) => scm_globals.set(key, value),
  },
  // ...
}

```

and then

```auto
(define-foreign globals-ref
  "interface" "readScmGlobals"
  (ref string)
  -> (ref eq))

(define-foreign set-globals!
  "interface" "setScmGlobals"
  (ref string)
  (ref eq)
  -> none)

```

I looked into the manual, but things like the `MutableString` class, for example, do not work the way I thought it would works.

Thank you!

---

<div class="post-metadata">

**Author:** ![dthompson](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.spritely.institute/dthompson/32/95_2.png) [@dthompson](https://community.spritely.institute/u/dthompson)\
**Post date:** [April 13, 2026, 1:12pm UTC](https://community.spritely.institute/t/how-do-you-create-scheme-objects-on-the-javascript-side-of-hoot/812/3 "2026-04-13T13:12:46Z")

</div>

You can’t create Scheme objects from JS without exporting functions from your Wasm binary to do so. The JS side is a _reflection_ library, and classes like `MutableString` are for inspecting values from Scheme, not creating new ones. Generally speaking, you want to drive your application from Scheme, not JS.
