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

Make hashCode part of Object #3218

Closed
DartBot opened this issue May 25, 2012 · 7 comments
Closed

Make hashCode part of Object #3218

DartBot opened this issue May 25, 2012 · 7 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report
Milestone

Comments

@DartBot
Copy link

DartBot commented May 25, 2012

This issue was originally filed by @tomyeh


The way Java handles hashCode and HashMap is much better. The user needs not to worry if any object being stored is hashable. Everything is hashable. By adding a default implementation of hashCode to Object (like toString), it makes API much simpler.

Related issues:
#1302 and #3132

@kasperl
Copy link

kasperl commented May 25, 2012

Added Area-Library, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jun 14, 2012

This comment was originally written by @tomyeh


Many issues are related to this issue: Issue #167, Issue #1302, Issue #3611...
There is a simple solution: make every object hashable like Java does.

Moreover, without it, null is not possible to be stored in Set and Map.

@DartBot
Copy link
Author

DartBot commented Jun 14, 2012

This comment was originally written by @tomyeh


It is sometime tedious to implement Hashable with Java's identityHashCode. It forces me to store an integer in the object just for implementing hashCode:(

@vsmenon
Copy link
Member

vsmenon commented Jul 18, 2012

Issue #2397 has been merged into this issue.


cc @dgrove.
cc @sethladd.
cc @kwalrath.
cc @kasperl.
cc @rakudrama.

@sethladd
Copy link
Contributor

Set owner to @gbracha.
Added this to the M1 milestone.
Removed Area-Library label.
Added Area-Language label.
Changed the title to: "Make hashCode part of Object".

@sethladd
Copy link
Contributor

Added Duplicate label.
Marked as being merged into #3369.

@floitschG
Copy link
Contributor

Issue #1302 has been merged into this issue.

@DartBot DartBot added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report labels Dec 5, 2012
@DartBot DartBot added this to the M1 milestone Dec 5, 2012
copybara-service bot pushed a commit that referenced this issue Dec 1, 2021
Changes:
```
> git log --format="%C(auto) %h %s" b9edfa5..dcb6aba
 https://dart.googlesource.com/pub.git/+/dcb6abac Merge remote-tracking branch 'origin/cherry-pick2-for-2.15.0'
 https://dart.googlesource.com/pub.git/+/dc857523 Remove duplicated lines in testdata (#3234)
 https://dart.googlesource.com/pub.git/+/acc8ab09 Refactor the test package-server (#3230)
 https://dart.googlesource.com/pub.git/+/1e78c688 Better error messages round 2 (#3223)
 https://dart.googlesource.com/pub.git/+/eaf36513 More links in the repository specification (#3220)
 https://dart.googlesource.com/pub.git/+/c888b018 Remove pedantic and cleanup a few lints (#3224)
 https://dart.googlesource.com/pub.git/+/a4d44c7e Global package server null safety (#3225)
 https://dart.googlesource.com/pub.git/+/ff941887 Merge branch 'cherry-pick-for-2.15.0'
 https://dart.googlesource.com/pub.git/+/efd24e64 Fix hanging event handler for `stdin`. (#3218)
 https://dart.googlesource.com/pub.git/+/d77c14e8 Gitignore validator should not follow symlink dirs (#3209)
 https://dart.googlesource.com/pub.git/+/7c190789 migrate rest of test/ to null-safety (#3207)
 https://dart.googlesource.com/pub.git/+/f24adb64 migrate test/oath2/ test/outdated/ test/token test/validator/ to null-safety (#3206)
 https://dart.googlesource.com/pub.git/+/e7d77a57 migrate test/add, test/cache, test/embedding plus a bit more to null-safety (#3205)
 https://dart.googlesource.com/pub.git/+/a6a73ad2 migrate test/lish/, test/run/, test/upgrade/ and golden_file.dart to null-safety (#3204)
 https://dart.googlesource.com/pub.git/+/b90efc1f Add test that `pub get` works with no $HOME in environment. (#3173)
 https://dart.googlesource.com/pub.git/+/c2fe3966 migrate test/get/ to null-safety (#3203)
 https://dart.googlesource.com/pub.git/+/1d106898 migrate test/hosted/ to null-safety (#3200)
 https://dart.googlesource.com/pub.git/+/afa9932b migrate test/cache and test/downgrade/ to null-safety (#3201)
 https://dart.googlesource.com/pub.git/+/352ca989 migrate test/global/ to null-safety (#3202)
 https://dart.googlesource.com/pub.git/+/64f20ca4 migrate test/descriptor/ and couple more files in test/ to null-safety (#3192)

```

Diff: https://dart.googlesource.com/pub.git/+/b9edfa5e288ea3d1a57d1db054ef844ae7b27d99~..dcb6abac2d7d43258c03b348be42bf4aab9529b1/
Change-Id: I30d33b0b8c3c19097a16543db15c6ae633f0afc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221633
Auto-Submit: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Jonas Jensen <jonasfj@google.com>
copybara-service bot pushed a commit that referenced this issue Nov 7, 2022
… webdev

Revisions updated by `dart tools/rev_sdk_deps.dart`.

crypto (https://github.com/dart-lang/crypto/compare/7cf89d3..e175a95):
  e175a95  2022-11-03  Devon Carew  refactor tests to use a more compact encoding (#134)

dartdoc (https://github.com/dart-lang/dartdoc/compare/179ada0..4b2e01b):
  4b2e01b6  2022-11-03  Sam Rawlins  Deprecate many elements on ModelElement (#3218)
  60cc024a  2022-11-03  Sam Rawlins  Make some logging APIs non-nullable (#3245)
  01c55118  2022-11-03  István Soós  Command-line arguments for limit max file count or total size. (#3231)

file (https://github.com/google/file.dart/compare/b2e31cb..b768f79):
  b768f79  2022-11-07  Devon Carew  add dependabot; run the CI weekly (#203)

intl (https://github.com/dart-lang/intl/compare/dda8ade..442193c):
  442193c  2022-11-07  Fernando Andrade  Fix typo on readme (#506)

shelf (https://github.com/dart-lang/shelf/compare/592656f..5fd2593):
  5fd2593  2022-11-07  Kevin Moore  latest mono_repo
  d1d8dc5  2022-11-07  Kevin Moore  shelf: fix lints (#307)
  64255e5  2022-11-03  Nate Bosch  Prepare to publish shelf_web_socket (#305)

test (https://github.com/dart-lang/test/compare/173a36f..f3fb3ab):
  f3fb3ab6  2022-11-05  stnamco  add lack of description to configuration document (#1782)

test_descriptor (https://github.com/dart-lang/test_descriptor/compare/66f14ce..13dbc20):
  13dbc20  2022-11-07  Kevin Moore  update lints (#45)

webdev (https://github.com/dart-lang/webdev/compare/069b870..47c1c33):
  47c1c33  2022-11-04  Anna Gringauze  Added issue references and removed unused library (#1752)
  542db40  2022-11-04  Anna Gringauze  Update analysis options in dwds (#1777)
  1a36ec8  2022-11-03  Elliott Brooks (she/her)  Send debug info from injected client to the debug extension (#1772)

Change-Id: I65dca831c71fa9487d663cc2a808b78b64424072
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268360
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

6 participants