This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Suggestion: move predef into empty package companion

2 replies
Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.

---------- 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._

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Suggestion: move predef into empty package companion

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.

Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
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:
>>
>> Id like to propose a spec change.  I think the scala.P...

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.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland