> From: "Brian Goetz" <[email protected]>
> To: "Kevin Bourrillion" <[email protected]>
> Cc: "amber-spec-experts" <[email protected]>
> Sent: Wednesday, September 28, 2022 10:10:02 PM
> Subject: Re: Paving the on-ramp
>>> - Make the "args" parameter to `main` optional, by allowing the `java` 
>>> launcher
>>> to
>>> first look for a main method with the traditional `main(String[])`
>>> signature, and then (if not found) for a main method with no arguments.

>> This seems to leave users vulnerable to some surprises, where the code they
>> think is being called isn't. Why not make it a compile-time error to provide
>> both forms?

> Currently, the treatment of methods called "main" is "and also"; it is a valid
> method, *and also* (if it has the right shape) can be used as a main entry
> point. Making this an error would take some valid programs and make them
> invalid, which seems a shift in the interpretation of the magic name "main". A
> warning is probably reasonable though.
The other solution is to do something similar to the compact constructor of a 
record, a compact main that have a syntax which is not currently valid in Java. 

Rémi 

Reply via email to