Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8972429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:12:59+00:00 2026-06-15T18:12:59+00:00

I am having problem with Predef.any2stringadd that unfortunately is officially considered not a PITA

  • 0

I am having problem with Predef.any2stringadd that unfortunately is officially considered not a PITA. I changed my API from

trait Foo {
   def +(that: Foo): Foo
}

to a type class approach

object Foo {
   implicit def fooOps(f: Foo): Ops = new Ops(f)
   final class Ops(f: Foo) {
      def +(that: Foo): Foo = ???
   }
}
trait Foo

Now I can hide that horrible method in compiled code like this:

import Predef.{any2stringadd => _}

However, this fails in my REPL/interpreter environment.

val in = new IMain(settings, out)
in.addImports("Predef.{any2stringadd => _}") // has no effect?

How can I tell the interpreter to vapourise this annoying method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:13:00+00:00Added an answer on June 15, 2026 at 6:13 pm

    A workaround seems to be to take the implicit conversion out of Foo‘s companion object, and place it in the top hierarchy (package object in my real case):

    object Foo {
    //   implicit def fooOps(f: Foo): Ops = new Ops(f)
       final class Ops(f: Foo) {
          def +(that: Foo): Foo = ???
       }
    }
    trait Foo
    implicit def fooOps(f: Foo): Foo.Ops = new Foo.Ops(f)
    

    While I don’t know why that should make any difference, it appears it does enough to make the interpreter forget about any2stringadd.

    (Still, I think a new ticket should be opened in an attempt to remove that method, also given that string interpolation in Scala 2.10 will make it more superfluous.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
having problem with null pointer exception and i read few article bout that error
hey there i am having problem i have List<List<memoryCard>> that i want to show
Hi i am having problem inserting data into multiple table from one view. First
Having problem to open form in new window, script is pulled from external service.
i having problem understanding what is wrong with my inheritance. I just can not
I`m having problem in getting an attribute from a xml object into JavaScript from
Im having problem in importing hotmail contacts from hotmail in php it simple give
I'm having problem with listening to an event dispatched from a child class, and
I am writing an API that I want to be usable from both Scala

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.