Suggestion for automatic wrapping of checked exceptions inside RuntimeExceptions inside closures
Stefan Reich
stefan.reich.maker.of.eye at googlemail.com
Sun Apr 30 15:07:19 UTC 2017
In my language (JavaX), this is automatic ^^
On Sat, Apr 29, 2017 at 1:04 AM, Behrang Saeedzadeh <behrangsa at gmail.com>
wrote:
> Hi,
>
> This has most likely been discussed before. In this yet another proposal, I
> suggest adding syntax sugar to make this automated. For example, by using a
> new arrow type (e.g. =>, #->, or maybe a new operator altogether: (╯°□°)╯︵
> ┻━┻).
>
> So we can turn:
>
> public class Main {
> public static void main(String[] args) throws IOException {
> final Path aDir = Paths.get(args[0]);
> Files.list(aDir).forEach(f -> {
> try {
> throw new IOException();
> } catch (IOException e) {
> throw new RuntimeException(e);
> }
> });
> }
> }
>
>
> into:
>
> public class Main {
> public static void main(String[] args) throws IOException {
> final Path aDir = Paths.get(args[0]);
> Files.list(aDir).forEach(f (╯°□°)╯︵ ┻━┻ {
> throw new IOException();
> });
> }
> }
>
> What do you think?
>
>
> Best regards,
> Behrang Saeedzadeh
> --
> Best regards,
> Behrang Saeedzadeh
>
More information about the adoption-discuss
mailing list