Skip to content

Dict : Accessing items with bracket, like an array or object #8163

@Freddy03h

Description

@Freddy03h

For adict{}, we can access a value only by using Dict.get

let d = dict{"A": 5, "B": 6, "C": 7}

let a = d->Dict.get("A")

The goal is to also using a bracket syntax, like with arrays or objects (without removing Dict.get, just like Array.get and Object.get still exist)

let d = dict{"A": 5, "B": 6, "C": 7}

let a = d["A"]

This would allow some bindings to use dict{} instead of {..} while keeping the same ease of access to values.


The next step could be variable keys but I created this feature request to propose a smaller step that can already be really useful, without having to wait for variable keys.

Metadata

Metadata

Assignees

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