Best Approach for Reading Scala DSL Code?

The Squeryl page has a Scala code sample at the top of the page :

import sbt._

class Project(info: ProjectInfo) extends DefaultProject(info) {

   val squeryl = "org.squeryl" % "squeryl_2.8.1" % "0.9.4-RC3"
}

I am puzzled that% is not a method defined in the RichString or String classes. My best guess is that it is defined elsewhere and is called an implicit conversion.

What is the best approach for reading and understanding such code in Scala?

+3
source share
3 answers

It can only come from import sbt._or from DefaultProject. Since sbtit is not a package object, it must come from DefaultProject.

, , ( object, ). , ( ) , , .

, . , Scaladoc, , .

, , Scala:

import scala.util.parsing.combinator.JavaTokenParsers
object T extends JavaTokenParsers {
    def myparser = "\\w+".r ~ "\\d+".r
}

~ Regex, . , .

: # , , . ~ : BigInt OnceParser. , , .

: JavaTokenParsers , , . implicit Regex - . , Parser. Parser .

implicit def regex, , , , : RegexParsers. JavaTokenParsers , .

, SBT API DefaultProject, , , 40 ( ) . , ManagedProject, , String GroupID RepositoryName, % %%, at.

+5

IntelliJ Scala , ^ b, . , , , .

+3

!

, , .

, , - SBT, google

+1
source

Source: https://habr.com/ru/post/1786678/


All Articles