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

  • Home
  • SEARCH
  • 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 4245706
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:52:34+00:00 2026-05-21T03:52:34+00:00

I was playing around with the new Scala IDE (Eclipse 3.6.2 + Scala IDE

  • 0

I was playing around with the new Scala IDE (Eclipse 3.6.2 + Scala IDE 2.0.0 [Scala 2.9.0]) and I tried to do something simple like this:

(1 to 10).sum

That works fine, but I’ve been doing a lot of Groovy also recently and I automatically wrote:

(1 to 10).sum()

This second version gives me a compiler error in the IDE with the following message:

not enough arguments for method sum: (implicit num: Numeric[B])B. Unspecified value parameter num.

I see on the Scala API that there are two versions of sum, one that takes no parameters and one that takes the implicit above. Do I have to call zero-argument methods without parentheses?

  • 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-21T03:52:34+00:00Added an answer on May 21, 2026 at 3:52 am

    The answer is that if you specify a parameter list (i.e. use the parens), then you must specify the parameters in it (or, more accurately, those without defaults).

    If you omit the parens on a non-empty parameter list whose parameters are implicit, then the compiler can inject them for you (assuming it can find the relevant implicits unabmiguously in your scope: as in your first example)

    1 to 10 sum
    

    If you want to pass in the parameter yourself (there is no need to do so in this example), then you can take advantage of Predef.implicitly which basically returns the unabiguous in-scope implicit value (assuming there is one). Their use here would be:

    (1 to 10).sum(implicitly[Numeric[Int]])
    (1 to 10).sum[Int](implicitly)
    

    This is particularly important in methods which take more than one implicit parameter, of which you might only wish to override one (you can then use implicitly for the others). For example, in scalaz

    aFoldable.sum(implicitly, myMonoid) //uses implicit Foldable but bespoke monoid
    

    For your question about the scaladoc use case; this is a phantom entry to show you how to use the (otherwise potentially confusing) method with the implicit parameter list. The existence of this scaladoc entry can be traced to this notorious question.

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

Sidebar

Related Questions

While playing around with regexps in Scala I wrote something like this: scala> val
I'm new to ruby and I'm playing around with the IRB. I found that
I'm pretty new to the Spring Framework, I've been playing around with it and
I'm playing around with the <canvas> element, drawing lines and such. I've noticed that
I have been playing around with Scala parser combinators for some time now, and
I am playing around with the new System.ComponentModel.Composition namespace in .NET 4.0 beta 2,
I recently starting playing around with the new features of Python 3.1 and porting
I'm new to Python and am playing around with making a very basic web
I'm new to Perl and playing around screen scraping and regex. I'm trying to
Just playing around with the now released Silverlight 2.0. I'm trying to put a

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.