Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add map literal syntax #25276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add map literal syntax #25276

wants to merge 1 commit into from

Conversation

dain
Copy link
Member

@dain dain commented Mar 11, 2025

Description

This PR adds a simple map literal syntax to the grammar. The grammar uses a comma separated list of key/value entries separated by =>. This is similar to the syntax for a function call with named parameters.

Under the covers the literal is translated to map_from_entries.

Examples

map('x' => 1, 'y' => 2);
map(1.1 => 'a', 2.2 => 'b');

Release notes

(X) Release notes are required, with the following suggested text:

## Section
* Add map literal syntax. For example, `map(1.1 => 'a', 2.2 => 'b')` ({issue}`issuenumber`)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant