-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Functions / closures are not Hashable #167
Comments
This comment was originally written by [email protected] Added Area-Language, Triaged labels. |
This comment was originally written by [email protected] This would be very useful when implementing observable objects. |
Added apr30-triage label. |
Removed apr30-triage label. |
Added triage1 label. |
Resurrecting this as a library question, since 144 of which this was considered a duplicate) is closed. Removed Area-Language label. |
Removed the owner. |
The request is for either I agree that making the Hash-containers able to take a strategy is a good idea. I would prefer these two to just making closures Hashable, since it's a more general solution. |
This comment was originally written by @bgourlie It seems this issue is making it difficult to implement a sane model for user-defined events. |
We should make closures hashable and provide an easy to understand equals behavior.
This in turn will make it possible to solve the problem with removing event handlers in the DOM without language guarantees for canonicalizing closures from instance methods. |
This comment was originally written by [email protected] To be clear about #2: if I have a type that overrides the equality operator, with instances 'a' and 'b' where a == b, would 'a.someMethod' compare equal to 'b.someMethod'? I'm guessing no, but clarity is good. |
I believe that a recent language review meeting decided that all objects shall be hashable. If so, this might now be a language issue. Set owner to @gbracha. |
Revisions updated by `dart tools/rev_sdk_deps.dart`. ffi (https://github.com/dart-lang/ffi/compare/3ede231..17a8142): 17a8142 2022-11-21 Daco Harkes Add links to API reference and examples to README (#167) fixnum (https://github.com/dart-lang/fixnum/compare/bca3816..62916f2): 62916f2 2022-11-24 Lasse R.H. Nielsen Split into separate libraries instead of using parts. (#97) 14d4827 2022-11-23 Lasse R.H. Nielsen Add `tryParse` methods. (#96) http (https://github.com/dart-lang/http/compare/d56141d..047d6ed): 047d6ed 2022-11-22 Brian Quinlan Fixes a bug where requests made in different Clients would fail (#827) 9dbbafb 2022-11-17 Brian Quinlan Add tests for compressed responses (#823) markdown (https://github.com/dart-lang/markdown/compare/37951d1..ee3f4e9): ee3f4e9 2022-11-24 Zhiguang Chen Fix a blockquote issue (#496) c9048c0 2022-11-16 Zhiguang Chen Optimise DelimiterSyntax (#492) protobuf (https://github.com/dart-lang/protobuf/compare/ae90e53..c181573): c181573 2022-11-23 Kevin Moore [api_benchmark] migrate to null-safety (#776) 648deaf 2022-11-23 Kevin Moore Standardize and fix lints (#775) bfa4c0d 2022-11-23 Kevin Moore Fix `///` at the top of generated Dart files (#774) ed68426 2022-11-17 Devon Carew Remove duplicate consts (#773) sse (https://github.com/dart-lang/sse/compare/283568d..8d018dd): 8d018dd 2022-11-23 Elliott Brooks (she/her) Format markdown files (#68) 2f6f151 2022-11-23 Elliott Brooks (she/her) Add optional `debugKey` parameter to SSE client (#67) eaee6a8 2022-11-23 Elliott Brooks (she/her) Use Fetch API in SSE Client (#66) test (https://github.com/dart-lang/test/compare/7756833..b25dac9): b25dac99 2022-11-21 Kevin Moore checks: finish async tests (#1793) 3166163e 2022-11-18 Devon Carew Update scorecards-analysis.yml (#1792) d930d5b0 2022-11-18 Nate Bosch Add support for async soft checks (#1789) b1411a21 2022-11-18 Devon Carew blast_repo fixes (#1788) a6aa04e0 2022-11-18 Jacob MacDonald disable wasm tests for now as they are failing (#1791) 8b5174c1 2022-11-17 Kevin Moore Starting on async tests (#1787) Change-Id: Ic361fce7753d08d43fc827f13cb1bfa1738cc16e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272343 Auto-Submit: Devon Carew <[email protected]> Reviewed-by: Kevin Moore <[email protected]> Commit-Queue: Devon Carew <[email protected]>
…ev, boolean_selector_rev, browser_launcher_rev, characters_rev, cli_util_rev, clock_rev, collection_rev, convert_rev, crypto_rev, csslib_rev Revisions updated by `dart tools/rev_sdk_deps.dart`. args (https://github.com/dart-lang/args/compare/a23ea85..bd3ac85): bd3ac85 2023-02-01 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#234) 86dacb3 2023-02-01 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#233) async (https://github.com/dart-lang/async/compare/f700e9a..8deaa40): 8deaa40 2023-02-01 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#234) b28604f 2023-02-01 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#233) bazel_worker (https://github.com/dart-lang/bazel_worker/compare/b35c25e..1124692): 1124692 2023-02-01 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#67) 1e57757 2023-02-01 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#68) benchmark_harness (https://github.com/dart-lang/benchmark_harness/compare/76881df..b1efcf7): b1efcf7 2023-02-02 Devon Carew add a publishing workflow action to dart-lang/benchmark_harness (#81) 4e0c4e8 2023-02-01 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#83) 010ea89 2023-02-01 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#82) boolean_selector (https://github.com/dart-lang/boolean_selector/compare/ba7d86b..16e6ad3): 16e6ad3 2023-01-31 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#42) c8874cc 2023-01-31 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#43) browser_launcher (https://github.com/dart-lang/browser_launcher/compare/f2f01e4..bc2dc4e): bc2dc4e 2023-01-31 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#38) 00a57fa 2023-01-31 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#39) characters (https://github.com/dart-lang/characters/compare/4526aa8..29f3a3e): 29f3a3e 2023-02-01 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#73) 6516030 2023-02-01 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#74) cli_util (https://github.com/dart-lang/cli_util/compare/32bc077..fd38b5f): fd38b5f 2023-01-31 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#74) 166fbac 2023-01-31 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#75) clock (https://github.com/dart-lang/clock/compare/65e8a13..5abb481): 5abb481 2023-02-01 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#43) 11b18ed 2023-02-01 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#44) collection (https://github.com/dart-lang/collection/compare/a566328..0d0e184): 0d0e184 2023-02-01 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#268) d0897af 2023-02-01 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#269) convert (https://github.com/dart-lang/convert/compare/20d136c..83886e3): 83886e3 2023-02-01 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#75) a522506 2023-01-31 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#74) crypto (https://github.com/dart-lang/crypto/compare/f854f2f..03eb2c9): 03eb2c9 2023-01-31 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#139) b6d6b33 2023-01-31 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#140) csslib (https://github.com/dart-lang/csslib/compare/f33d632..e6c8308): e6c8308 2023-01-31 Devon Carew fix the reported span for expressions (#167) a190358 2023-01-31 Devon Carew add a repro for #136 (#160) fa3e221 2023-01-31 Devon Carew correct the logic in isPredefinedName (#166) Change-Id: I68bc236d4e0b5c31b5d629f2b89f82f56d30a28e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281260 Auto-Submit: Devon Carew <[email protected]> Commit-Queue: Nate Bosch <[email protected]> Reviewed-by: Nate Bosch <[email protected]>
Revisions updated by `dart tools/rev_sdk_deps.dart`. ecosystem (https://github.com/dart-lang/ecosystem/compare/e96fbdb..babf5d1): babf5d1 2023-09-13 Devon Carew add additional lints to dart_flutter_team_lints (#167) 7740bef 2023-09-13 Moritz Write comments on forks for `firehose` (#165) http (https://github.com/dart-lang/http/compare/de19214..e19094a): e19094a 2023-09-14 Brian Quinlan Use efficient operations when copying bytes between Dart and Java (#1019) d7e4375 2023-09-13 Parker Lougheed Cleanup `package:http` utils (#1011) eafbbb0 2023-09-12 Brian Quinlan Separate the cronet callbacks from the `send` method (#1017) 2cbb703 2023-09-12 Brian Quinlan Switch `cronet_http` to use jnigen (#1016) native (https://github.com/dart-lang/native/compare/bbcbc1f..7faf62c): 7faf62c 2023-09-14 Gabriel Terwesten Add `includes`, `flags`, `std`, `language`, `cppLinkStdLib` options (#125) shelf (https://github.com/dart-lang/shelf/compare/2926f76..e2a02b7): e2a02b7 2023-09-13 Kevin Moore Move to latest pkg:dart_flutter_team_lints, bump min sdk to Dart 3 (#378) tools (https://github.com/dart-lang/tools/compare/fa01f9b..1512f3d): 1512f3d 2023-09-13 Elias Yishak Add Fake Analytics instance that uses list to save events sent (#149) webdev (https://github.com/dart-lang/webdev/compare/6b21ecf..501ccc2): 501ccc28 2023-09-12 Elliott Brooks Update DCM triggers to match Dart DevTools (#2230) Change-Id: Ic3dc1924da48454a28e4c0d8705244ac1565e74a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325967 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Devon Carew <[email protected]>
Revisions updated by `dart tools/rev_sdk_deps.dart`. lints (https://github.com/dart-lang/lints/compare/2cf8403..5c60f48): 5c60f48 2023-10-30 Michael Goderbauer Update README.md to use new syntax for adding dev dependencies (#167) mockito (https://github.com/dart-lang/mockito/compare/4edf86f..b7d752e): b7d752e 2023-10-26 Ilya Yanok Use Dart SDK 3.1.0 for format check ca537db 2023-10-26 Ilya Yanok Remove unneeded deprecation warning disable comment 1a0d0e7 2023-10-26 Ilya Yanok Remove deprecated `returnNullOnMissingStub` and `OnMissingStub.returnNull` native (https://github.com/dart-lang/native/compare/757f503..279094d): 279094d 2023-10-30 Pierrick Bouvier [native_toolchain_c] Support MSVC arm64 toolchain (#167) 9629a55 2023-10-27 Parker Lougheed Allow modification of a BuildOutput's raw dependencies (#169) 762b4da 2023-10-27 Ryan Macnak [native_assets_cli] Add Android RISCV64 target. (#166) 18bff8c 2023-10-25 Ryan Macnak [native_toolchain_c] Setup Linux X64 toolchain for non-X64 hosts. (#164) d79a7cd 2023-10-25 Ryan Macnak [native_toolchain_c] Setup Linux RISCV64 toolchain. (#163) ce26f75 2023-10-25 Parker Lougheed Update all lints and dart_flutter_team_lints dependencies (#161) protobuf (https://github.com/dart-lang/protobuf/compare/3528fad..3f567b2): 3f567b2 2023-10-27 Ömer Sinan Ağacan Remove the dynamic call in `CodedBufferWriter` (#895) 42436cd 2023-10-26 Ömer Sinan Ağacan Keep a `ByteData` around in `CodedBufferReader` to avoid repeated `ByteData` allocs (#890) 9a73936 2023-10-26 Ömer Sinan Ağacan Avoid adding empty splices in `CodedBufferWriter` (#886) 23dffde 2023-10-26 Ömer Sinan Ağacan Update a bug link in a comment (#892) 19903f0 2023-10-26 Ömer Sinan Ağacan Make `CodedBufferWriter.writeRawByte` argument type more accurate (#891) 2ce3e14 2023-10-26 Ömer Sinan Ağacan Update `FieldInfo._ensureRepeatedField` return type (#893) e146515 2023-10-25 Ömer Sinan Ağacan Avoid redundant ByteData allocation when decoding sfixed64 (#889) 1b1d549 2023-10-25 Ömer Sinan Ağacan Avoid allocating temporary views in when decoding strings in `CodedBufferReader` (#888) tools (https://github.com/dart-lang/tools/compare/da6bb18..e828d45): e828d45 2023-10-27 Elias Yishak Create tests for each event constructor (#186) webdev (https://github.com/dart-lang/webdev/compare/25f17cd..50534a1): 50534a12 2023-10-30 Elliott Brooks Cider passes an app ID instead of a workspace name to connect to the Dart Debug Extension (#2272) b3d6ef14 2023-10-27 Elliott Brooks Expose a keyboard shortcut to copy the Dart app ID (#2271) c26b4e5f 2023-10-27 Elliott Brooks Reset Webdev to 3.3.0-wip after release (#2269) 982b955b 2023-10-26 Elliott Brooks Prepare webdev for 3.2.0 (#2268) 62361fbf 2023-10-26 Elliott Brooks Reset DWDS after release (#2267) 50b8ae86 2023-10-26 Elliott Brooks Prepare DWDS for release to version 22.1.0 (#2266) Change-Id: Ia02db3bc66bac55b637ed5e173fe5c5d50bcca52 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332748 Auto-Submit: Devon Carew <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
I have a program that walks a datastructure that contains various objects including functions and needs to detect if the same object / function (f1 === f2) occurs twice.
I can't do this with HashMap for several reasons:
I would be happy with
(a) A HashMap that takes the hash function and equivalence as a parameter
(b) a way of generating a hash code for closures.
The text was updated successfully, but these errors were encountered: