| Commit-Queue | +1 |
if (!_toStringVisiting.isBound) {Alexander AprelevGiven that we introduced `FinalThreadLocal` anyway... Maybe you can rewrite this code to use that instead. And I think when you do that you can share the iterableToFullString and iterableToShortString methods back - it becomes platform independent.
Platform dependent part is `toStringVisiting`, which for VM becomes:
```
List get toStringVisiting => _toStringVisiting.value;
...
```And the rest of code can be shared.
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
for (int i = 0; i < toStringVisiting.length; i++) {Consider caching result of getter, e.g.
```
final visiting = toStringVisiting;
for (int i = 0; i < visiting.length; i++) {
if (identical(object, visiting[i])) return true;
}
return false;
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
Consider caching result of getter, e.g.
```
final visiting = toStringVisiting;
for (int i = 0; i < visiting.length; i++) {
if (identical(object, visiting[i])) return true;
}
return false;
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | -1 |
Don't move map-function into `Iterable` and don't make the helper functions public.
const smallChangeThreshold = 13;(Arbitrary number just changed arbitrarily, for _reasons_! 😜)
static List<Object> get toStringVisiting => _toStringVisiting;That looks like it's just
```dart
@patch
static final List<Object> toStringVisiting = [];
```
with more steps. Unless that's not an allowed patch, then it's *necessary* more steps. Is it necessary?
static String mapToString(Map<Object?, Object?> m) => Iterable.mapToString(m);Don't move this function. It doesn't belong in `Iterable`.
static String mapToString(Map<Object?, Object?> m) {This is a new public function.
It used to be in `MapBase` and now it's in `Iterable`.
If it's no longer in `MapBase`, that's a breaking change, so don't remove it.
Also, it doesn't really belong in `Iterable`, maps are not `Iterable`, so why move it here?
If it stays, it should have a `@Since("3.11")`, or whatever version it goes into, and be documented in the CHANGELOG.md.
If you want to share it without needing to import `dart:collection`, then put it in `dart:_internal` and let `MapBase` reference it there.
static bool isToStringVisiting(Object object) {This should *probably* not be public.
external static List<Object> get toStringVisiting;This should _definitely_ not be public.
(Which tips the `toStringVisiting` towards not being public either.)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
static List<Object> get toStringVisiting => _toStringVisiting;That looks like it's just
```dart
@patch
static final List<Object> toStringVisiting = [];
```
with more steps. Unless that's not an allowed patch, then it's *necessary* more steps. Is it necessary?
Patching getter with final variable doesn't work, and I believe it has to remain getter for vm/iterable_patch.dart FinalThreadLocal implementation.
static String mapToString(Map<Object?, Object?> m) => Iterable.mapToString(m);Don't move this function. It doesn't belong in `Iterable`.
The function still remains, it's just that its implementation delegates to Iterable.mapToString because that's where patched toStringVisiting lives.
Alexander AprelevWhy moved?
They were moved because toStringVisiting has to be patched, has different implementation on vm vs other platforms.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
This is a new public function.
It used to be in `MapBase` and now it's in `Iterable`.If it's no longer in `MapBase`, that's a breaking change, so don't remove it.
Also, it doesn't really belong in `Iterable`, maps are not `Iterable`, so why move it here?If it stays, it should have a `@Since("3.11")`, or whatever version it goes into, and be documented in the CHANGELOG.md.
If you want to share it without needing to import `dart:collection`, then put it in `dart:_internal` and let `MapBase` reference it there.
I added Since and added entry to changelog.
I'm not sure I understand how to share it since it needs to be part of this class.
This should *probably* not be public.
Done
This should _definitely_ not be public.
(Which tips the `toStringVisiting` towards not being public either.)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
static String mapToString(Map<Object?, Object?> m) {Alexander AprelevThis is a new public function.
It used to be in `MapBase` and now it's in `Iterable`.If it's no longer in `MapBase`, that's a breaking change, so don't remove it.
Also, it doesn't really belong in `Iterable`, maps are not `Iterable`, so why move it here?If it stays, it should have a `@Since("3.11")`, or whatever version it goes into, and be documented in the CHANGELOG.md.
If you want to share it without needing to import `dart:collection`, then put it in `dart:_internal` and let `MapBase` reference it there.
I added Since and added entry to changelog.
I'm not sure I understand how to share it since it needs to be part of this class.
Why does it need to be part of this class? Can all the "toStringVisiting" behavior, and it's static state, be moved to a shared library? The public APIs can be small forwarding implementations. Changing public API for implementation detail changes worries me.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
static String mapToString(Map<Object?, Object?> m) {Alexander AprelevThis is a new public function.
It used to be in `MapBase` and now it's in `Iterable`.If it's no longer in `MapBase`, that's a breaking change, so don't remove it.
Also, it doesn't really belong in `Iterable`, maps are not `Iterable`, so why move it here?If it stays, it should have a `@Since("3.11")`, or whatever version it goes into, and be documented in the CHANGELOG.md.
If you want to share it without needing to import `dart:collection`, then put it in `dart:_internal` and let `MapBase` reference it there.
Nate BoschI added Since and added entry to changelog.
I'm not sure I understand how to share it since it needs to be part of this class.
Why does it need to be part of this class? Can all the "toStringVisiting" behavior, and it's static state, be moved to a shared library? The public APIs can be small forwarding implementations. Changing public API for implementation detail changes worries me.
Why does it need to be part of this class?
For patching to work if I understand correctly patched methods needs to be part of some class. So previous public top-level-implementation(in internal.dart) won't work. This class already hosts recursive-friendly infrastructure for iterable toString operations, so it seems to be reasonable place to host map-specific toString operation as well.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
static String mapToString(Map<Object?, Object?> m) {Alexander AprelevThis is a new public function.
It used to be in `MapBase` and now it's in `Iterable`.If it's no longer in `MapBase`, that's a breaking change, so don't remove it.
Also, it doesn't really belong in `Iterable`, maps are not `Iterable`, so why move it here?If it stays, it should have a `@Since("3.11")`, or whatever version it goes into, and be documented in the CHANGELOG.md.
If you want to share it without needing to import `dart:collection`, then put it in `dart:_internal` and let `MapBase` reference it there.
Nate BoschI added Since and added entry to changelog.
I'm not sure I understand how to share it since it needs to be part of this class.
Alexander AprelevWhy does it need to be part of this class? Can all the "toStringVisiting" behavior, and it's static state, be moved to a shared library? The public APIs can be small forwarding implementations. Changing public API for implementation detail changes worries me.
Why does it need to be part of this class?
For patching to work if I understand correctly patched methods needs to be part of some class. So previous public top-level-implementation(in internal.dart) won't work. This class already hosts recursive-friendly infrastructure for iterable toString operations, so it seems to be reasonable place to host map-specific toString operation as well.
Ah I didn't realize it was related to limitations in patching, I doubt I'll be able to find any alternatives to suggest in that case.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | -1 |
static String mapToString(Map<Object?, Object?> m) {Alexander AprelevThis is a new public function.
It used to be in `MapBase` and now it's in `Iterable`.If it's no longer in `MapBase`, that's a breaking change, so don't remove it.
Also, it doesn't really belong in `Iterable`, maps are not `Iterable`, so why move it here?If it stays, it should have a `@Since("3.11")`, or whatever version it goes into, and be documented in the CHANGELOG.md.
If you want to share it without needing to import `dart:collection`, then put it in `dart:_internal` and let `MapBase` reference it there.
Nate BoschI added Since and added entry to changelog.
I'm not sure I understand how to share it since it needs to be part of this class.
Alexander AprelevWhy does it need to be part of this class? Can all the "toStringVisiting" behavior, and it's static state, be moved to a shared library? The public APIs can be small forwarding implementations. Changing public API for implementation detail changes worries me.
Nate BoschWhy does it need to be part of this class?
For patching to work if I understand correctly patched methods needs to be part of some class. So previous public top-level-implementation(in internal.dart) won't work. This class already hosts recursive-friendly infrastructure for iterable toString operations, so it seems to be reasonable place to host map-specific toString operation as well.
Ah I didn't realize it was related to limitations in patching, I doubt I'll be able to find any alternatives to suggest in that case.
I'd really prefer to just not have this method on `Iterable`. It doesn't belong there, maps are not iterables.
Keep the function in `MapBase`, or move the implementation to `dart:internal` if you want to share it.
If that's a problem with `_istoStringVisiting` and `_toStringVisiting`, move them all to `dart:_internal`. The two `*toStringVisiting` declarations can be public there.
_(We really should have the core implementation in `dart:_core` which `dart:core` then exports *some* of. That would allow us to have public helpers in the same library, without exposing them to the world.)_
static String mapToString(Map<Object?, Object?> m) {Still think this shouldn't be in `Iterable`. Maps are not iterables, there is no reason for it to be *here*.
Keep it in `MapBase`, and move `*toStringVisiting` to `dart:internal`
so it can be used from both `dart:core` and `dart:collection`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
thank you Lasse for the suggestions.
static String mapToString(Map<Object?, Object?> m) {Alexander AprelevThis is a new public function.
It used to be in `MapBase` and now it's in `Iterable`.If it's no longer in `MapBase`, that's a breaking change, so don't remove it.
Also, it doesn't really belong in `Iterable`, maps are not `Iterable`, so why move it here?If it stays, it should have a `@Since("3.11")`, or whatever version it goes into, and be documented in the CHANGELOG.md.
If you want to share it without needing to import `dart:collection`, then put it in `dart:_internal` and let `MapBase` reference it there.
Nate BoschI added Since and added entry to changelog.
I'm not sure I understand how to share it since it needs to be part of this class.
Alexander AprelevWhy does it need to be part of this class? Can all the "toStringVisiting" behavior, and it's static state, be moved to a shared library? The public APIs can be small forwarding implementations. Changing public API for implementation detail changes worries me.
Nate BoschWhy does it need to be part of this class?
For patching to work if I understand correctly patched methods needs to be part of some class. So previous public top-level-implementation(in internal.dart) won't work. This class already hosts recursive-friendly infrastructure for iterable toString operations, so it seems to be reasonable place to host map-specific toString operation as well.
Lasse NielsenAh I didn't realize it was related to limitations in patching, I doubt I'll be able to find any alternatives to suggest in that case.
I'd really prefer to just not have this method on `Iterable`. It doesn't belong there, maps are not iterables.
Keep the function in `MapBase`, or move the implementation to `dart:internal` if you want to share it.
If that's a problem with `_istoStringVisiting` and `_toStringVisiting`, move them all to `dart:_internal`. The two `*toStringVisiting` declarations can be public there.
_(We really should have the core implementation in `dart:_core` which `dart:core` then exports *some* of. That would allow us to have public helpers in the same library, without exposing them to the world.)_
Done
Still think this shouldn't be in `Iterable`. Maps are not iterables, there is no reason for it to be *here*.
Keep it in `MapBase`, and move `*toStringVisiting` to `dart:internal`
so it can be used from both `dart:core` and `dart:collection`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
friendly ping
| Commit-Queue | +1 |
Adding Nate for updates to dart2wasm test expectations
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
///[nit] Can we delete this? I see it's an existing pattern in this file, but I don't think it's a good pattern to keep.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
still looking for +1 from dart2wasm test owners.
[nit] Can we delete this? I see it's an existing pattern in this file, but I don't think it's a good pattern to keep.
Thanks Nate, I put them there to group top-levels variables with the top-level test methods they used in. Without any delimiters it felt it was hard to see the reason for top-level variables to be interleaved with the metods. Do you have a better suggestion?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
thank you Nate!
[vm/sdk] Use FinalThreadLocal for Iterable toString.
This allows use of toString in isolategroup-bound callbacks.
BUG=https://github.com/dart-lang/sdk/issues/61030.
TEST=ci
CoreLibraryReviewExempt: effectively vm-only change
Change-Id: Iccdc218716cbbe2346aa85bb6134f4129debe057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/451841
Reviewed-by: Nate Biggs <nate...@google.com>
Commit-Queue: Alexander Aprelev <a...@google.com>
Reviewed-by: Lasse Nielsen <l...@google.com>
Reviewed-by: Nate Bosch <nbo...@google.com>
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Alexander Aprelev[nit] Can we delete this? I see it's an existing pattern in this file, but I don't think it's a good pattern to keep.
Thanks Nate, I put them there to group top-levels variables with the top-level test methods they used in. Without any delimiters it felt it was hard to see the reason for top-level variables to be interleaved with the metods. Do you have a better suggestion?
I think either `//` or blocking by only including blank lines between blocks are both slightly preferable to `///` which stands out as a blank doc to me, but the ROI on changing is not as high in that case so I'd also be fine leaving well enough alone.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |