Created
July 19, 2010 18:04
-
-
Save retronym/481742 to your computer and use it in GitHub Desktop.
Using Power Mode in the Scala REPL to find the parameter names of a method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> :power | |
** Power User mode enabled - BEEP BOOP ** | |
** scala.tools.nsc._ has been imported ** | |
** New vals! Try repl, global, power ** | |
** New cmds! :help to discover them ** | |
** New defs! Type power.<tab> to reveal ** | |
scala> val s = repl.stringToCompilerType("scala.Some") | |
s: repl.compiler.Type = object Some | |
scala> val applyMethod = s.members.find(_.name.toString == "apply").get | |
applyMethod: repl.compiler.Symbol = method apply | |
scala> val param00Name = apply.paramss(0)(0).name | |
param00Name: repl.compiler.Name = x |
sorry, you can't quit from power mode: https://stackoverflow.com/questions/6856589/is-there-a-way-to-exit-power-mode-in-the-scala-interpreter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, how to quit from power mode?