- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Suggestion: move predef into empty package companion
Sat, 2011-02-19, 13:42
---------- Forwarded message ----------
From: "Josh Suereth" <joshua.suereth@gmail.com>
Date: Feb 19, 2011 7:36 AM
Subject: Suggestion: move predef into empty package companion
To: "scala-internals@listes.epfl.ch" <scala-internals@listes.epfl.ch>Id like to propose a spec change. I think the scala.Predef object should be moved into the empty package as a special empty package object. This will place the magical implicits available in every scope by allow them to be overriden/shadowed as needed by users.
I think it's a far cleaner mechanism than having a hidden import scala.Predef._
Sat, 2011-02-19, 23:07
#2
Re: Suggestion: move predef into empty package companion
I think moving everything possible to a companion is a great idea.
One question: if predef abided by the spec.... Why would you ever need to import it?
Two: couldn't we make something like _root_._ work?
On Feb 19, 2011 11:37 AM, "Paul Phillips" <paulp@improving.org> wrote:On 2/19/11 4:42 AM, Josh Suereth wrote:
As far as I know, getting rid of Predef is the eventual goal. But you don't want to move them to the empty package. The empty package is segregated from all other code. You can't import from the empty package, by design, and you wouldn't see its contents.
>>
>> Id like to propose a spec change. I think the scala.P...
The only place you can move the contents of Predef without creating new complications is the scala package object, which I assume has obstacles but I don't know off the top of my head what they are.
On 2/19/11 4:42 AM, Josh Suereth wrote:
>> Id like to propose a spec change. I think the scala.Predef object
>> should be moved into the empty package as a special empty package
>> object. This will place the magical implicits available in every
>> scope by allow them to be overriden/shadowed as needed by users.
>>
>> I think it's a far cleaner mechanism than having a hidden import
>> scala.Predef._
As far as I know, getting rid of Predef is the eventual goal. But you
don't want to move them to the empty package. The empty package is
segregated from all other code. You can't import from the empty
package, by design, and you wouldn't see its contents.
The only place you can move the contents of Predef without creating new
complications is the scala package object, which I assume has obstacles
but I don't know off the top of my head what they are.