Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Dynamically initializing a non mutable array #515

@ericvergnaud

Description

@ericvergnaud

Hi,

I'm probably missing the obvious but I can't seem to find a way to dynamically populate a non mutable array:

  • there is no array.new_xxx for initializing a new array from existing array data or from linear memory
  • array.set fails if dest array is not mutable
  • array.copy fails if dest array is not mutable

There are many scenarios where a non-mutable array needs to be dynamically populated rather than sourced from static data. Some examples:

  • string literal: init non mutable array from utf-8 data, convert it to utf-16 stored into a mutable array, init the string struct with a non mutable array copied from the previous mutable array
  • string concat
  • etc...

What am I missing ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions