Skip to content

Instantly share code, notes, and snippets.

🌻

Jentsch Jentsch

🌻
Block or report user

Report or block Jentsch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Jentsch
Jentsch / Expressions in string interpolation.md
Last active May 11, 2016
Expressions in string interpolation
View Expressions in string interpolation.md

Expressions in string interpolation

During the fives episode of the [scalaprofies podcast][SP] the two Speaker where questioning for a special string interpolation that shows the definition of parts instead of evaluated result of the expressions. Invalid expressions should be still rejected by the compiler and refactoring tools should also affect the expressions within the string interpolation. Here we will implement such a functionality and see the tip of the of the iceberg of macros and string interpolation.

Example:

scala> def f(x: Int) = x * 2
View DependentKeyValue.scala
class Key[V] {
type Value = V
def ->(value: V) = Pair(this, value)
}
trait Pair {
val key: Key[_]
val value: key.Value
}
trait Map {
val pairs: Seq[Pair]
You can’t perform that action at this time.