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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:36:37+00:00 2026-05-26T04:36:37+00:00

Suppose I have a the following in Scala object Foo { var functions: List[String

  • 0

Suppose I have a the following in Scala

object Foo {
  var functions: List[String => String] = Nil // can be any type to any type.
  def addFunc(f:String => String) = functions = f :: functions
}

At runtime, I am given Foo with some functions added. I now want to construct a new .class file implementing something like following in Scala:

object MyObject { 
  def process1(s:String) = // call Foo.functions(1)
}

I then want to save MyObject in bytecode that can be executed later on even when Foo is not there.

The above is just an example to show what I want to do . I am given the names MyObject, process1, and I have to generate an executable file MyObject.class. The source of MyObject is not needed (it could well have been Java source).

So, at a high level, we need to take memory “snapshot” of Foo.function(1), convert that snapshot into bytecode to store, and generate bytecode of MyObject using this.

All the bytecode engineering libraries I found are too low-level, so I was wondering if there is a higher level library that lets me deal with abstract objects such as functions etc.

  • 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-26T04:36:38+00:00Added an answer on May 26, 2026 at 4:36 am

    Have you looked at the Tree model of ASM? I’ve only used the Event model before, but the Tree sounds like just what you’re looking for. You’ll find an overview in section 1.2.2 of the ASM user guide (a PDF–I don’t think there’s an HTML version, or I’d link that).

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

Sidebar

Related Questions

Suppose I have following code def foo(x:Int):Unit = { if (x == 1) println
In Scala (2.7), if I have this function: def foo(args: Array[String]) = for (arg
Suppose we have following code defined in tester.py class Tester( object ): def method(
Suppose I have following code: def foo(s): A dummy function foo. For example: >>>
suppose I have the following datastructure: var user = {_id: 'foo', age: 35}; var
Suppose I have following string: String asd = this is test ass this is
Suppose you have the following string: white sand, tall waves, warm sun It's easy
Suppose I have following html page. <html> <head> <link type=text/css rel=Stylesheet href=css/some.css /> </head>
Suppose I have the following scala classes ( that needs to improve to address
Suppose I have the following abstract class: abstract class A (var is_happy : Boolean)

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.