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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:43:54+00:00 2026-06-08T14:43:54+00:00

After watching Martin’s keynote on Reflection and Compilers I can’t seem to get this

  • 0

After watching Martin’s keynote on Reflection and Compilers I can’t seem to get this crazy question out of my head. Martin talks among other things about the “(Wedding) Cake Pattern”, where traits play the central part. I’m wondering, why in the world do we need packages when we already have traits? Is there anything a package can do, what a trait (at least theoretically) cannot?

I’m not talking about the current implementation, I’m just trying to imagine what programming would be like if we replace packages with traits. In my head it would be like this:

  • one keyword less (package is unneeded)
  • no need for package objects

To summarize all my questions:

  1. Is it theoretically possible to remove packages from the language and use traits instead.
  2. What other benefits would we gain from this change? (I was thinking about first class packages and first class imports, but mixin composition is a compile time thing, although the super calls are dynamically bound)
  3. Is Java/JVM compatibility the only thing, which would stand in the way?

Update

Daniel Spiewak talks in this keynote about the Dependency Injection being just the top of the iceberg of all the stuff you can do with the Cake Pattern.

  • 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-08T14:43:55+00:00Added an answer on June 8, 2026 at 2:43 pm

    Martin Odersky has said that Scala could get by with just traits, objects, methods and paths (I hope I didn’t forget something).

    Both classes and packages are just there because Scala is intended to be a hosted language, i.e. a language which runs on (this is actually not the interesting bit) and interoperates with (this is the important point) a host platform. Some of the host platforms that Scala is intended to interoperate with are the Java platform and the CLI, both which have a concept of classes and packages (namespaces in the case of the CLI) that is significantly distinct enough that it cannot be easily expressed as traits or objects. This is unlike interfaces, which can be trivially mapped to and from purely abstract traits.

    The above statement was made in a discussion about potentially removing generics from Scala, because everything generics can do can also be achieved by abstract types.

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

Sidebar

Related Questions

I've read about Single-Page Applications recently and wanted to try one out. After watching
Introduction After watching this video from LIDNUG, about .NET code protection http://secureteam.net/lidnug_recording/Untitled.swf (especially from
After watching the very known video on this topic I decided to go with
After watching this video , I am wondering if I am using my controllers
After watching RailsCasts #273 I want to use the Geocoder gem. I've seen this:
After watching this video , I started thinking about how I could implement something
After watching the Knockout.JS video with Steve Sanderson I decided this would be great
This is a more theoretical question: When I'm watching larger videos (> 15 min)
After watching the Stanford iTunesU CS193p online course I have quick question regarding the
Google weather API shows temperature in Fahrenheit. After watching this post , I was

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.