ballercat/walt

Memory, Table as a generic Type

ballercat opened this issue · 0 comments

Goal

Support custom memory declarations and imports.

Overview

Currently, it's only possible to import a default Memory type which has a { initial: 1 } value which cannot be overwritten with in any way. See #86

The updated syntax should convert Memory type to a generic.

New syntax:

// imports should look like so
import { memory: Memory<{ initial: 10, max: 20 }> } from 'env';

// declarations note the dropped initializer syntax
const memory: Memory<{ initial: 10, max: 100 }>;

// default Memory type should remain at { initial: 10 }, but the <> should be kept for consistency
const memory: Memory<>;

Acceptance Criteria

  • Tests
  • Tests pass
  • Updated examples and demos