Details

      Description

      Having just written this email, I am led to wonder if there's some reason we can't just lift classes and objects out of the package object into the package.

      Don't put objects and classes in package objects.  It kind of works
      sometimes, but it exposes you to these corner cases, and for no
      gain: the best case is that it works like it would have if you'd
      just put the objects/classes in the package.
       
      Like this.
       
      package object PkgObj {
             def hi(s: String) = s
      }
      package PkgObj {
        object App extends Application {
                println(hi("hello,world"))
        }
      }
       
      If you look at what is generated the way you had it you will see
      why there is a problem.  To run a program the bytecode has to be
      where it's supposed to be, no tricks.
       
      ls -l PkgObj/
      total 24
      -rw-r--r--  1 paulp  wheel   498 Mar 16 09:31 package$$.class
      -rw-r--r--  1 paulp  wheel  1076 Mar 16 09:31 package$$App$$.class
      -rw-r--r--  1 paulp  wheel   683 Mar 16 09:31 package.class
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                retronym Jason Zaugg
                Reporter:
                extempore Paul Phillips
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated: