Skip to content

Commit 29da91a

Browse files
committed
Correct misleading instructions for publishing a local Scala version
1 parent b0fae73 commit 29da91a

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

contribute/hacker-guide.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,20 +160,26 @@ Here are also some tips & tricks that have proven useful in Scala development:
160160
* Don't underestimate the power of `print`. When starting with Scala, I spent a lot of time in the debugger trying to figure out how
161161
things work. However later I found out that print-based debugging is often more effective than jumping around. While it might be obvious
162162
to some, I'd like to explicitly mention that it's also useful to print stack traces to understand the flow of execution. When working with `Trees`, you might want to use the Scala `showRaw` to get the `AST` representation.
163-
* You can publish your newly-built scala version locally using `sbt publishLocal` to use it from `sbt`. Here's how:
163+
* You can publish your newly-built scala version locally using `sbt publishLocal`. Then, you can invoke a REPL using your version:
164164

165165
$ sbt publishLocal // This may take a while
166166
...
167167
$ sbt
168168
...
169-
> console
170-
[info] Starting scala interpreter...
171-
[info]
172-
Welcome to Scala version 2.10.6 (OpenJDK 64-Bit Server VM, Java 1.8.0_91).
173-
Type in expressions to have them evaluated.
174-
Type :help for more information.
175-
176-
scala>
169+
> scala
170+
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp
171+
Welcome to Scala 2.12.0-20160613-195040-cd85531 (OpenJDK 64-Bit Server VM, Java 1.8.0_91).
172+
Type in expressions for evaluation. Or try :help.
173+
174+
scala>
175+
176+
Alternatively, you can invoke a REPL using the bash script in `./build/quick/bin/`:
177+
178+
$ ./build/quick/bin/scala
179+
Welcome to Scala 2.12.0-20160613-195040-cd85531 (OpenJDK 64-Bit Server VM, Java 1.8.0_91).
180+
Type in expressions for evaluation. Or try :help.
181+
182+
scala>
177183

178184
* Adding a macro to the `Predef` object is a pretty involved task. Due to bootstrapping, you cannot just throw a macro into it. For this reason, the process is more involved. You might want to follow the way `StringContext.f` itself is added. In short, you need to define your macro under `src/compiler/scala/tools/reflect/` and provide no implementation in `Predef` (`def fn = macro ???`). Now you have to set up the wiring. Add the name of your macro to `src/reflect/scala/reflect/internal/StdNames.scala`, add the needed links to it to `src/reflect/scala/reflect/internal/Definitions.scala`, and finally specify the bindings in `src/compiler/scala/tools/reflect/FastTrack.scala`. [Here's](https://github.com/folone/scala/commit/59536ea833ca16c985339727baed5d70e577b0fe) an example of adding a macro.
179185

0 commit comments

Comments
 (0)