Description
I keep running into this and I wonder if this is something we can address before 1.0. It's small enough that I think it's doable, but big enough to require some decision making/consensus from the language team.
The current semantics of main is a bit different of what I normally expect it to be. This is in part because we wrote these semantics before we had the notion of 'exports'.
Current meaning:
If you run "a.dart", look and see if the library define by 'a.dart' has a 'main' in it's scope (either because it is defined or imported) and run it.
Meaning I expected:
If you run "a.dart", see if 'a' has a visible 'main' method (defined directly by 'a.dart' or exported from it) and run it.
The following examples illustrate the differences:
b.dart:
library b;
main() => print('hi');
a1.dart:
import 'b.dart';
a2.dart:
export 'b.dart';
dart a1.dart # prints 'hi'
dart a2.dart # Dart_Invoke: did not find top-level function 'main'.