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

Remove MirrorsUsed and Comment from dart:mirrors before Dart 2.0 release #32507

Closed
rmacnak-google opened this issue Mar 12, 2018 · 10 comments
Closed
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. customer-dart-2 enhancement-breaking-change An enhancement which is breaking. library-mirrors type-enhancement A request for a change that isn't a bug

Comments

@rmacnak-google
Copy link
Contributor

Dart2JS no longer implements mirrors; as such its cruft should be removed from mirrors.

  • MirrorsUsed was added only for dart2js to inform its tree shaker.
  • Comment was only used internally by dart2js, and it was never possible to get an instance at runtime.
@sigmundch sigmundch added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-mirrors labels Mar 12, 2018
@sigmundch
Copy link
Member

For a transitional period, we still allow importing dart:mirrors from dart2js, but we fail at runtime. That means that using the @MirrorsUsed annotation is ignored. If we remove it before we make importing mirrors a compile time error, we risk introducing an unintended breaking change.

We should time these changes to happen at once.

@kevmoo
Copy link
Member

kevmoo commented May 7, 2018

At a minimum, we should mark MirrorsUsed as deprecated ASAP IMHO

@anders-sandholm
Copy link
Contributor

Fixed (MirrosUsed marked as deprecated) in cdc520f

@rmacnak-google
Copy link
Contributor Author

The issue is for removal, not deprecation.

@lrhn lrhn added enhancement-breaking-change An enhancement which is breaking. type-enhancement A request for a change that isn't a bug labels Oct 1, 2020
@Sunbreak
Copy link

Sunbreak commented Jul 2, 2021

MirrorUsed is still there. We would keep it or not?

@lrhn
Copy link
Member

lrhn commented Jul 2, 2021

We still want to get rid of it, but there were other higher-priority issues in the Dart 2.0 release, so it didn't make it there.

It doesn't do anything anymore, so we should be able to remove it at any time (preferably along with some other deprecated declarations, in one fell breaking change).

@Sunbreak
Copy link

Sunbreak commented Jul 2, 2021

Is there any alternatives for escaping from tree shaking?

https://github.com/google/reflectable.dart seams to be stale as well

@eernstg
Copy link
Member

eernstg commented Jul 2, 2021

The package reflectable hasn't been abandoned, I'm keeping it alive in my spare time.

It hasn't been updated to handle types with nullability (so if you have a TypeMirror you can't ask whether the type is nullable or not), but it works fine with programs using the current language, in partially or fully null-safe programs. It will be extended to expose nullability when I can find some time, but you may well be able to use it also without that feature. Of course, dart:mirrors also do not expose nullability in their TypeMirror, yet.

Ah, by the way, you might be able to test nullability using TypeMirror.isSubtypeOf to check whether it is a subtype of Object and whether Null is a subtype of it: If both are true then it is a legacy type, if the former is true and the latter is false then it is a non-nullable type, and if the former is false and the latter is true then it is a nullable type.

So you could take a look at reflectable! ;-)

@Sunbreak
Copy link

Sunbreak commented Jul 2, 2021

Thanks a lot. I'll try it and post the result later

@mit-mit
Copy link
Member

mit-mit commented Jul 19, 2022

@mit-mit mit-mit self-assigned this Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. customer-dart-2 enhancement-breaking-change An enhancement which is breaking. library-mirrors type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

8 participants