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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:25:49+00:00 2026-05-26T00:25:49+00:00

Follow-up to this SO question. Suppose I have the code def bar(param: {def foo:

  • 0

Follow-up to this SO question.

Suppose I have the code

def bar(param: {def foo: Unit}*) = param.foreach(x => x.foo)

This function causes object param to invoke a method named foo

[EDIT]

I was wondering if the following is possible (with or without reflection)

  • param is fixed at compile time, the name of the function (in this case foo) is supplied at runtime
  • both param and the name of the function foo are supplied at runtime
  • param is fixed at compile time, the name of the function, the function parameters, values and return types are supplied at runtime.

I realize Structural typing already uses reflection. So my question is if Scala can take care of it or if I have explicitly use reflection in my code. I think the 3rd one requires reflection for which I can use the ASM library.

  • 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-26T00:25:50+00:00Added an answer on May 26, 2026 at 12:25 am

    If I understand your question:

    1. At compile-time, the compiler checks that each param has indeed a method foo with the correct signature.
    2. At runtime, reflection is used underneath to call the method foo of each param

    So you don’t need to use reflection yourself, but you should keep it mind that reflection will be used at runtime, and could potentially decrease performances.

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

Sidebar

Related Questions

This is somewhat of a follow-up question to this question . Suppose I have
this is a follow-up question of mine. Suppose now I have a URL :
Follow up to this question . I have the following code: string[] names =
I have a question relating to the usage of this. Suppose I have two
I suppose this question is a follow up to a previous question I had
Suppose we have the following class hierarchy: class ClassA: @property def foo(self): return hello
Follow up to this question about GNU make : I've got a directory, flac
This question is a follow on from this one ... I am binding to
In follow up to this question , it appears that some numbers cannot be
[a follow up to this question ] class A { public: A() {cout<<A Construction

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.