Skip to content

Dynamically Sized Arrays v0.1 #328

@baszalmstra

Description

@baszalmstra

This is a tracking issue regarding the implementation of dynamically sized arrays.

This reflects the work that is required for an initial release of Mun with array support (arrays v0.1). This will allow the construction and use of arrays but will still miss a lot of essential features to make working with them easier.

Out of scope

Things that are out of scope for this initial v0.1 version:

  • Querying the length of an array
  • Resizing an array
  • Appending to an array

Required work

  • Array types
    Mun must have support for array types so we can pass them around in code.

    • Syntax of array types must be parsable
    • The vscode grammar must be updated to support these types
    • Code generation to handle array types
    • ABI support for array types
    fn identity(arr: [int]) -> [int] { arr }
    
  • Array construction
    Enable the construction of arrays from mun code.

    let a = [1,2,3,4]
    
    • Syntax support for array literals
    • HIR support for array literals including type inferencing
    • Runtime support for allocation of array literals
    • Support arrays in the garbage collector
    • Support hot reloading of arrays.
    • Use arrays through the runtime.
    • Create arrays through the runtime.

    Open questions

    • What and how do we support the hot-reloading of arrays? Which operations are (not) allowed?
  • Array indexing support.

    let a = arr[i]
    arr[i] = 3.0
    
    • Syntax support for array indexing
    • HIR support for array indexing including type inferencing
    • Language server support for array indexing (proper completion in brackets)
    • Code generation for array indexing

Metadata

Metadata

Labels

trackingTracking issue for an epic

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions