-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.core-nlibrary-coretype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
This issue was originally filed by dharcourt@chromium.org
What steps will reproduce the problem?
- Run the following program:
main() {
var a = [1, 2];
var b = [1, 2];
var m = {a: 42};
print(m[a]);
print(m[b]);
print(a == b);
}
What is the expected output? What do you see instead?
- Expected: 42, 42, and true.
- Actual: 42, null, and false.
What version of the product are you using? On what operating system?
Dart VM version: 1.2.0-dev.5.12 (Thu Feb 20 01:54:16 2014) on "macos_x64"
Please provide any additional information below.
- The fact that Lists implement pointer hashing and pointer comparison reduces their usability. Content hashing and content comparison would provide much better semantics.
- Obviously the lists in the example above could be made constants to solve the problem in this particular case, but this is not possible in the general case.
- Similar improvements to equality and hashing could be made for Sets and Maps (see issue List, Set and Map should have a method to compare if elements are equal #2217), but Lists are probably the most important use case.
ramsestom and WildOrangutan
Metadata
Metadata
Assignees
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.core-nlibrary-coretype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug