Skip to content

Allow destructuring function arguments! - #4562

Merged
toots merged 9 commits into
mainfrom
destructure-function-arguments
Jul 12, 2025
Merged

toots merged 9 commits into
mainfrom
destructure-function-arguments

Conversation

@toots

@toots toots commented Jul 11, 2025

Copy link
Copy Markdown
Member

This PR adds support for pattern matching inside function arguments:

  x = 123
  def f({foo}, [a, b], ~x:{gni}) =
    test.equal(foo, 123)
    test.equal(a, "aaa")
    test.equal(b, "bbb")
    test.equal(x, 123)
    test.equal(gni, 3.14)
  end
  f({foo=123}, ["aaa", "bbb"], x={gni=3.14})

Comment thread src/lang/parser.mly Outdated
@toots
toots marked this pull request as ready for review July 11, 2025 17:22
@toots
toots requested a review from smimram July 11, 2025 17:22
@toots
toots merged commit 3669ca5 into main Jul 12, 2025
@toots
toots deleted the destructure-function-arguments branch July 12, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant