@@ -258,9 +258,29 @@ inadvertently break a capability that the type offers.
258
258
### Capabilities on legacy classes
259
259
260
260
The above syntax means that it an error to implement, mixin, or extend a class
261
- declared just using ` class ` . This would break nearly all existing Dart code.
262
- To avoid that, we specify that Dart classes that are not in modules are
263
- implicitly treated as if they were declared as ` open interface mixin class ` .
261
+ declared just using ` class ` . This would break nearly all existing Dart code if
262
+ it were retroactively applied to existing code.
263
+
264
+ Fortunately, we have [ language versioning] [ ] to help. Dart libraries still at
265
+ the language version before modules will behave as if all class declarations
266
+ are implicitly marked with all of the capabilities the class can support. In
267
+ particular:
268
+
269
+ * All classes are treated as implicitly marked ` interface ` .
270
+
271
+ * If the class has at least one generative constructor (which may be default)
272
+ and is not marked ` abstract ` it is treated as implicitly marked ` open ` .
273
+
274
+ * If the class has no constructors, it is treated as implicitly marked
275
+ ` mixin ` .
276
+
277
+ [ language versioning ] : https://dart.dev/guides/language/evolution#language-versioning
278
+
279
+ When updating a library to the language version that supports modules, you'll
280
+ want to decide what capabilities to offer, or just place all the modifiers you
281
+ can to preserve the class's current behavior.
282
+
283
+ ** TODO: Investigate tooling to automatically migrate.**
264
284
265
285
## Capability controls on members
266
286
0 commit comments