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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:12:29+00:00 2026-05-31T09:12:29+00:00

In Scala you can define parameters that descend from other one that take the

  • 0

In Scala you can define parameters that descend from other one that take the first one as parameter. For example in Lift you can find such things in Record and Mapper

MongoMetaRecord[BaseRecord <: MongoRecord[BaseRecord]]

What does it mean and how is that useful ?

  • 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-05-31T09:12:31+00:00Added an answer on May 31, 2026 at 9:12 am

    This is a pattern often used to let an abstract class know about the type of the actual concrete class that extends it. It is sometimes useful to know what that final concrete type is — for instance, to use it as the return type of a method that produces a copy of the current object.

    Suppose you want to do this — let an abstract class Abstract know about the concrete type implementing it. You could start by defining a type parameter, maybe like this:

    trait Abstract[A] {
      def copyObject: A = ...
    }
    

    But then you realize that actually, A should be a subclass of Abstract itself, as you don’t want subclasses to provide a random parametrization. So you could add this:

    trait Abstract[A <: Abstract]
    

    … but you’ll soon realize that Abstract has turned into a generic type as well, so you’ll rather need this:

    trait Abstract[A <: Abstract[A]]
    

    As a final step, you’ll probably want to make A covariant if you can, so as to allow intermediate abstract classes along the inheritance path from Abstract to the final concrete class:

    trait Abstract[+A <: Abstract[A]]
    class Concrete1 extends Abstract[Concrete1]
    
    trait RefinedAbstract[+A <: RefinedAbstract[A]] extends Abstract[A]
    class Concrete2 extends RefinedAbstract[Concrete2]
    

    This means that every non-leaf (abstract) type should be parametrized, and that only the final concrete class will be able to drop the type parameter.

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

Sidebar

Related Questions

As we know that we can define a repeated-parameter (varargs) function in scala, like
I'm learning Scala and there is a thing that I can't find out about
(Yes I know I can call Java code from Scala; but that is pointless;
Is there a way to overload methods in Scala that take multiple parameter lists?
In Scala, how does one define a local parameter in the primary constructor of
In Scala, you can define package objects . It seems thus that you can
Using File::Find , how can I pass parameters to the function that processes each
Why can't i define a variable recursively in a code block? scala> { |
Can I set maximum size for an actor's mailbox in Scala? Take the Producer-Consumer
In Scala, I can define structural types as follows: type Pressable = { def

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.