What is the reason for choosing the current syntax `import foo.bar. {Baz => _} `to exclude something from import?

I wonder if there is a good reason for this optical mismatch between e. d. pattern matching that uses simple

case foo =>

so that there is no action.

It would be wise to have something like

import foo.bar.{Baz => }

instead

import foo.bar.{Baz => _}

considering what is _used as β€œimport everything” into the same statement?

+3
source share
1 answer

I would suggest it for symmetry with renamed imports:

import java.util.{Collection => JCollection, _}

If we want to import an invalid identifier:

import java.util.{Collection => _          , _}

( , _ , => , .)

+4

Source: https://habr.com/ru/post/1746870/


All Articles