- Concurrency
- DSL
- Pattern matching
- ADTs (Algebric Data Types)
- Lambdas
- Immutability
- Contextual parameters
- flow dsl
Principles 1.
Misc
implicit
overloaded for- exetension methods
- type classes
- implicit parameters
- implicit conversions
Why scala changing so fast?
-
Inspirations from different languages.
-
Opinionated language? So many ways of doings things?
frameworks
- zio and cats
- Reactive frameworks
Misc
private [this]
- scala cli
- scala worksheet in intellij
sealed
- variance and co-variance
- contra-variant
- netty
- https://github.com/delta-io/delta-sharing/tree/main/project
cs
cs launch scala:3.3.0
sbt
sbt new <template>
Collections
List
list.span
::
cons operator:::
concat operator
enum
- lists are created using sharing references of previous list.
- Structural sharing.
- Consists of two parts
- head
- cons
-
compute length
Why not lazy evaluation.
- memory profile prediction is hard for application
Custom list
enum Lst[+T]:
case Empty
case Cons[T](head: T, tail: Lst[T])
sealed trait Lst[+T]
object Lst:
case object Empty extends Lst[Nothing]
case Cons[T](head: T, tail: Lst[T]) extends Lst[T]
-
GJ generic java
-
class cast exception
todo
- animal super class
- dog and cat sub class
- make list of dogs and animals
- make an array of dogs and animals.
- Try to add cat in the list of animals.
- Try to add cat in the array of animals.