Skip to content
Compile-time expression evaluation for Scala
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
project
src
.gitignore
LICENSE
README.md
build.sbt
release.sbt
version.sbt

README.md

Expression Evaluator

Compile-time expression evaluation for Scala

Publish it locally:

sbt clean +publishLocal

Add the library with a "provided" scope to your dependencies list:

libraryDependencies ++= Seq(
  "com.github.plokhotnyuk.expression_evaluator" %% "expression_evaluator" % "0.0.1-SNAPSHOT" % Provided // required only in compile-time
)

Generate expression results for primitives and array of primitives:

import com.github.plokhotnyuk.expression_evaluator._

object Constants {
  val x = eval(10 * 10 * 10)
  val xs = eval((1 to 3).toArray)
}

To see generated code for expression results

scalacOptions ++= Seq("-Xmacro-settings:print-expr-results")
You can’t perform that action at this time.