score:0

First thanks to om-nom-nom also. Earlier I was using the import clause like below: import Vegetables.{Asparagus=>,} Instead of the REPL saying something like "Hey you asked me not to import Asparagus with your renaming clause, so I have no Asparagus to give you" it was still returning Asparagus.name and Asparagus.color. (when I typed in "import Asparagus.name" as a test)

This was when I realized I was missing something. The result is counter intuitive. Asparagus was supposed to be not visible. On taking a closer look I found I had goofed up in the following way:

I had forgotten to factor in the fact that earlier I had already imported object Vegetable using the following statement: import com.att.scala.Vegetable.

The above statement must have brought in all members of Vegetable into the scope. Later I applied the renaming and catch-all clause and it did not work because of the first import. So I decided to try on a fresh slate again.

I restarted Eclipse, fired up Eclipse and issued the following commands: This time I did it as below:

     **import com.att.scala.Vegetables.{Asparagus=>_,_}**

       **Asparagus.name**

The REPL came right back with the following response:

         **<console>:11: error: not found: value Asparagus
          Asparagus.name
          ^**

This was my intended result.


Related Query

More Query from same tag