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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:54:04+00:00 2026-06-11T20:54:04+00:00

Defined the following implicit def meant to implement some methods required by an Akka

  • 0

Defined the following implicit def meant to implement some methods required by an Akka actor event bus. The methods required are outlined in the documentation here: http://doc.akka.io/docs/akka/2.0/scala/event-bus.html#Subchannel_Classification

protected implicit def subclassification: Subclassification[Classifier] = {
      def isEqual(a: Classifier, b: Classifier): Boolean = {
        a.equals(b)
      }

      def isSubclass(a: Classifier, b: Classifier): Boolean = {
        a.startsWith(b)
      }

  }

However, when I go to compile it I get the error: type mismatch; found : Unit required: akka.util.Subclassification[MessageBus.this.Classifier]

Here’s what the documentation asks for specifically:

subclassification: Subclassification[Classifier] is an object
providing isEqual(a: Classifier, b: Classifier) and isSubclass(a:
Classifier, b: Classifier) to be consumed by the other methods of this
classifier.

I’m aware that this would return a unit, but how would I make the implementations necessary that could also provide those member methods?

  • 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-11T20:54:05+00:00Added an answer on June 11, 2026 at 8:54 pm

    Did you mean to instantiate a subclass of Subclassification[Classifier]? If so, you need to say new Subclassification[Classifier] so that Scala knows that what’s you’re trying to do.

    protected implicit def subclassification: Subclassification[Classifier] = 
      new Subclassification[Classifier] {
        def isEqual(a: Classifier, b: Classifier): Boolean = {
          a.equals(b)
        }
    
        def isSubclass(a: Classifier, b: Classifier): Boolean = {
          a.startsWith(b)
        }
    }
    

    The reason it complains is because you are assigning to the variable subclassification a block of code that contains only two function declarations. Since Scala always assumes the last expression in the block to be what the expression evaluates to, and the type of a function declaration is Unit (basically meaning that it doesn’t evaluate to anything), Scala says that the entire block has type Unit.

    Since you are assigning the block to the variable subclassification, subclassification must be of type Unit. But you explicitly state that the type should be Subclassification[Classifier], so there is a mismatch, and you get an error.

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

Sidebar

Related Questions

I have the following classes with an implicit cast operator defined: class A {
I have defined the following classes and methods: using System; using System.Linq.Expressions; using System.Windows.Forms;
In Scala (2.7.7final), the Predef.println method is defined as having the following signature: def
I have defined following control template for my custom control. <ControlTemplate TargetType={x:Type local:CustomControl}> <Grid
I have defined following in a ResourceDictionary: <DockPanel x:Key=errorDisplay LastChildFill=False> <Border Background=Red DockPanel.Dock=Top> <TextBlock
In my .htaccess file I have defined following rule, RewriteRule t/([^.]+)/$ /videos/tag.php?tag=$1 [QSA] The
ive defined the following and filled it with elements: vector <vector<double> > my_vector; but
I have defined the following class using COM to use the IGroupPolicyObject using C#.NET:
I have defined the following two functions test <- function(t) { return( (0.5*eta^2/theta)*(1-exp(-2*theta*t)) )
I have defined the following struct in C: typedef struct point{ float x; float

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.