walt icon indicating copy to clipboard operation
walt copied to clipboard

Destructuring Assignment

Open ballercat opened this issue 6 years ago • 1 comments

Goal

Allow users to use destructuring assignment.

Overview

Destructuring assignment is pretty helpful and should be implemented. Destructured variables should become locals. Destructured variables should not need type annotation as they can be inferred, so that is super useful.

Acceptance Criteria

  • [ ] const [x, y] = arrayObject;
  • [ ] const {x, y} = vectorObject;
  • [ ] Type annotations for destructured locals are not necessary
  • [ ] Tests

ballercat avatar Jan 07 '18 20:01 ballercat

WASM "is" a stack machine, right? Does that mean you can in theory return multiple values by leaving multiple values on the stack, like in Forth and other concatenative languages? Is something like (type (func (param i32) (result i32 i32))) legal WASM?

Asking out of curiosity of how returning multiple values might be implemented in Walt (not directly applicable to destructuring, but potentially a way of doing "strength reduction" if an optimising pass is ever introduced?)

JobLeonard avatar Mar 20 '18 01:03 JobLeonard