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 8482595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:51:48+00:00 2026-06-10T19:51:48+00:00

I am using Akka for actor model programming with Scala, and in order to

  • 0

I am using Akka for actor model programming with Scala, and in order to fully and sufficiently use some features of my structure, I decided to use an implicit conversion from a Scala abstract class to an Akka ActorRef. It goes something like this:

abstract class A {
   val actor = system.actorOf(Props(new C),"dummy")
   def send(msg: String) = actor ! msg // This compiles fine
}

class C extends akka.actor.Actor {
   def receive = {case msg => println(msg)}
}

implicit def AtoC(a:  A) = a.actor

Then I use it this way:

class D extends A

val d = new D

Normally, and since the conversion works fine, I should be able to send a message to the actor in D just by doing this:

d ! message // This does not compile

But It’s not allowed apparently, This is not a big problem since I can still use the tell method:

d.tell(message)

I can still use the “!” by using this conversion instead:

implicit def AtoC(a:  A) = a.actor.asInstanceOf[ScalaActorRef]

But, if I do this I won’t be able to use any ActorRef method. I can live with not being able to use “!” but I would like to understand why a conversion causes such a behavior, or am I missing something?

Thank you!

  • 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-10T19:51:49+00:00Added an answer on June 10, 2026 at 7:51 pm

    Because Scala doesn’t do multiple implicit conversions. ! is an implicit conversion from ActorRef to ScalaActorRef (to hide symbolic methods from Java API):

    /**
     * This trait represents the Scala Actor API
     * There are implicit conversions in ../actor/Implicits.scala
     * from ActorRef -> ScalaActorRef and back
     */
    trait ScalaActorRef { ref: ActorRef ⇒
    
      /**
       * Sends a one-way asynchronous message. E.g. fire-and-forget semantics.
       * <p/>
       *
       * If invoked from within an actor then the actor reference is implicitly passed on as the implicit 'sender' argument.
       * <p/>
       *
       * This actor 'sender' reference is then available in the receiving actor in the 'sender' member variable,
       * if invoked from within an Actor. If not then no sender is available.
       * <pre>
       *   actor ! message
       * </pre>
       * <p/>
       */
      def !(message: Any)(implicit sender: ActorRef = null): Unit
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Scala application using Akka that receives REST requests, makes some operations
I am using Akka FSM for handling state in my Actor. I want some
Integrating redis with my Scala application using Akka but for some reason it does
Akka framework recommends using typed actor only for interacting with external code. However, standard
I have implemented an Actor system using Akka and its Java API UntypedActor. In
I was wondering the best implementation of a DAG (Directed Acyclic Graph) using Scala/Akka
I am using akka for some time. I started to see some patterns in
I'm using Scala IDE 2.0.1 and SBT 0.11.2 to start with Akka 2.0.1. My
I'm fairly new to Akka and new to distributed programming in general. Using Akka's
I am currently studding Scala 2.8 using Programming in Scala 2nd edition. But I

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.