« VCD dumping in Chisel 6.5 / svsim | Home
Pure Terminal Ammonite Replacement for Scala 3.9
By admin | October 6, 2026
Ammonite is gone in Scala 3.9 🙁 This architecture delegates live values to a global object scope before passing thread control over to the official native compiler shell runner.
1. Define a global “mailbox” object anywhere in the project:
package com.example
object TerminalDebugBridge:
var foo: Any = null
var bar: Any = null
2. Update the drop-to-repl invocation:
// Replicating Ammonite's drop-in functionality natively
if (true) {
// 1. Manually map the variables into the global container scope
com.example.TerminalDebugBridge.foo = foo
com.example.TerminalDebugBridge.bar = bar
println("\n=======================================================")
println(" LAUNCHING NATIVE AMMONITE-LIKE SCALA 3 INTERACTIVE REPL")
println(" Access fields via: com.example.TerminalDebugBridge._ ")
println("=======================================================")
// 2. Programmatically invoke stock Scala compiler REPL driver
dotty.tools.repl.Main.main(Array("-usejavacp"))
}
3. Run it via the Terminal
When the application runs and hits this line, the process will block and launch a standard Scala 3.9 REPL console prompt (scala>) right in the middle of the active terminal window.
To look inside the variables, import the bridge and cast the data back to its complex type definition:
scala> import com.example.TerminalDebugBridge
scala> val mySerializer = TerminalDebugBridge.serializer.asInstanceOf[TheSerializerType]
scala> println(mySerializer.complexInternalState)
When one is done diagnosing the logic, type Ctrl + D or :quit, and the native JVM thread will exit the REPL and resume application code.
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: Code | No Comments »
