TROOPS - we are hiring talanted Scala engineers: https://troops.ai/careers
Video: https://www.youtube.com/watch?v=dNyoPOyhYpg
How does scalac compile implicit classes? Where does the implicit class get de-sugared and how is the implicit method represented inside the compiler? How does scalac search for a matching implicit method? Learn about the machinery behind the language semantics - the phases: parser, namer, typer and the data structures: Compilation Unit, Context, Tree, Symbol, Scope - by jumping into the code.
4. Goal
Understand the Scala compiler by tracing the
compilation of a simple program and concentrating on a
single feature
5. Agenda
1. What is Implicit Conversion?
2. Result & RichResult
3. Compiler Data Structures & Phases
4. parser Phase
5. namer Phase
6. typer Phase
6. Implicit Conversion
1. Scala Language Specification 7.3
2. Scala Improvement Process 13
“In a selection e.m with e of type T, if the
selector m does not denote an accessible member of T
… a view v is searched which is applicable to e and
whose result contains a member named m.”
“An implicit class is desugared into a class and
implicit method pairing, where the implicit method
mimics the constructor of the class.”
7. Implicit Conversion
1. Scala Language Specification 7.3
2. Scala Improvement Process 13
“In a selection e.m with e of type T, if the
selector m does not denote an accessible member of T
… a view v is searched which is applicable to e and
whose result contains a member named m.”
“An implicit class is desugared into a class and
implicit method pairing, where the implicit method
mimics the constructor of the class.”