dart-lang / sdk

The Dart SDK, including the VM, dart2js, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
9.99k stars 1.54k forks source link

Some error classes don't make sense in Dart2 #33949

Open matanlurey opened 6 years ago

matanlurey commented 6 years ago

This is not exhaustive, and probably too late for Dart2, but maybe Dart3?

In addition, these three errors don't seem to ever... be used:

It might make sense to make them private, I don't know if anyone ever tries to catch these?

lrhn commented 6 years ago

The CyclicInstantantiationError can still happen. It's used for lazily initialized static fieds.

The AbstractClassInstantiationError is obsolete. I think FallThroughError is too.

Seems like a good time to introduce a deprecation policy, so we can deprecate them and remove them in Dart 3.

bkonyi commented 5 years ago

Not sure what you mean by "don't seem to ever be used" for the last three. I'm fairly certain that the VM is more than happy to throw those exceptions.

matanlurey commented 5 years ago

@bkonyi:

Not sure what you mean by "don't seem to ever be used" for the last three

Rather, users do not ever try to catch them or use them as types. They might make sense to make private and no longer export via dart:core, as it adds additional mental overhead to navigating the API docs and auto-complete for all Dart files but doesn't seem to be particularly useful.

lrhn commented 3 years ago

See also #34233.