dart-lang / dart-lang/language

[Value Classes] Collection equality

Open
#3,307 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

The draft for value classes was just added by @munificent and I noticed that it didn't seem to mention collection equality (correct me if I'm wrong). I know the spec was just added but I figured I'd open an issue to get dialogue on this topic.

```dart
value class Company {
String name;
List employees;

Company(this.name, this.employees);
}
```

If I were to create instances like so:

```dart
final company1 = Company('Foo', ['bar']);
final company2 = Company('Foo', ['bar']);
```

Would these be equal even though they're not const?

Also will there be deep `Map` equality?

Contributor guide

Open the contributing guide

Research direction

Start with the value classes draft referenced in the issue and review how equality is specified for fields containing List and Map values. Done means reaching and recording a clear decision about non-const collection equality and deep Map equality in the value-class specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.