Skip to content

Latest commit

 

History

History
145 lines (121 loc) · 7.24 KB

README.md

File metadata and controls

145 lines (121 loc) · 7.24 KB

Blog Rock the JVM

Dotty project Directory rockthejvm-examples\ contains Scala 3 code examples coming from Ciocîrlan's blog Rock The JVM.

Code examples presented below can be built/run with the following tools:

Build tool Build file(s) Parent file(s) Environment(s)
ant.bat build.xml build.xml, ivy.xml Any a)
cmd.exe build.bat
(build.properties)
cpath.bat b) Windows only
sh.exe build.sh
(build.properties)
Cygwin/MSYS2/Unix only
make.exe Makefile Makefile.inc Any
mvn.cmd pom.xml pom.xml Any
sbt.bat build.sbt n.a. Any
a) Here "Any" means "tested on Windows, Cygwin, MSYS2 and Unix".
b) This utility batch file manages Maven dependencies and returns the associated Java class path (as environment variable).
 

ExtensionMethods Example

Code example ExtensionMethods is presented in Ciorcîlan's blog post Scala 3: Extension Methods (April 2021).

> build -verbose run
Compile 1 Scala source file to directory "target\classes"
Execute Scala main class "rockthejvm.Main"
Hi, I'm Daniel, nice to meet you.
t1=Branch(Leaf(a),Leaf(b))
t2=Branch(Leaf(A),Leaf(B))
tree=Branch(Leaf(1),Leaf(2))
three=3
three1=3

Givens Example

Code example Givens is presented in Ciorcîlan's blog post Givens vs. Implicits in Scala 3 (November 2020).

> build -verbose run
Compile 1 Scala source file to directory "target\classes"
Execute Scala main class "rockthejvm.Main"
Hey, I'm Alice. Scala rocks!

Hey, I'm Alice. Scala rocks!

InfixMethods Example

Code example InfixMethods is presented in Ciorcîlan's blog post Infix Methods in Scala 3 (November 2020).

> build -verbose run
Compile 1 Scala source file to directory "target\classes"
Execute Scala main class "rockthejvm.Main"
Person(Mary)
Mary likes Forrest Gump
Mary likes Forrest Gump

Person(Mary)
Mary likes Forrest Gump

Enums Example

Code example Enums is presented in Ciorcîlan's blog post Enums in Scala 3 (September 2020).

> build -verbose run
Compile 1 Scala source file to directory "target\classes"
Execute Scala main class rockthejvm.Main
bitString=4
hexString=4
 
first=0
allPermissions=READ WRITE EXEC NONE
fromBits(2)=WRITE

EtaExpansion Example

Code example EtaExpansion is presented in Ciorcîlan's blog post Eta-Expansion and Partially Applied Functions in Scala (August 2020).

> build -verbose run
Compile 1 Scala source file to directory "target\classes"
Execute Scala main class "rockthejvm.Main"
incrementMethod(3)=4
three=3
threeExplicit=3
List(2, 3, 4)
List(3, 4, 5)
ten=10

mics/May 2024