Skip to content

Require that main is a method that optionally takes List<String> arguments #27824

@jacob314

Description

@jacob314

The DartVM supports cases such as

var main = () {
  return () => print('hello');
}();

but there is no advantage of writing that code instead of the simpler

main() {
  print('hello');
}

Worse, defining main as a variable instead of a method is broken in Dart2JS.
We should statically require that
main()
be a function that returns void and that only accepts an optional List parameter as arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions