Skip to content

#003 — Demystifying Implicits; Asynchronicity and Laziness with Monix

Photo of Ionuț G. Stan
Hosted By
Ionuț G. S.
#003 — Demystifying Implicits; Asynchronicity and Laziness with Monix

Details

We have two talks scheduled for this edition:

  1. Luminița Apostol — Demystifying Implicits
  2. Alexandru Nedelcu — On Dealing with Asynchronicity and Laziness by Means of Monix

More details below.

Luminița Apostol — Demystifying Implicits

ABSTRACT: Implicits are a powerful, code-condensing feature of Scala, considered by some users "the second hardest feature, first being to convince your manager to use Scala". With implicits, dependencies are resolved at compile-time, code base size is drastically reduced by removed boilerplate, classes are loosely coupled, extendable and yet type safe.

A great feature, so what is it so hard?

The implicit system allows the compiler to adjust code using a lookup mechanism and to solve implicit ambiguities using some precedence rules. The multitude of rules of implicits resolution algorithm and the compiler converting types leads to hard-to-debug and possibly dangerous behavior - associating implicits feature with mystery, magic and controversy.

During this meet-up, we'll try to better understand what implicits are and how we can use them. In the mean time, we'll zoom into the resolution mechanism to understand some of its rules — basically we'll try to learn how to unleash implicits' great power and to diminish the associated confusion.

BIO: Luminița Apostol is a Software Developer at Endava Bucharest and has a 4 years' experience in developing and testing telecom, financial and payment applications and services. She mainly focused on JVM based technologies (Java, Groovy, Scala), having an increased interest in functional and reactive programming due to her work with Scala and the innovative technology stack around it (Akka, Spray).

Alexandru Nedelcu — On Dealing with Asynchronicity and Laziness by Means of Monix

ABSTRACT: Scala is a functional programming language. But when doing functional programming, sooner or later you end up with recursive or asynchronous algorithms.

Scala’s Future from the standard library is great, but sometimes we need something else. A Future strives to be a value, one detached from time and for this reason its capabilities are restricted. Also for some use-cases its behavior ends up being unintuitive. Hence, while the Future/Promise pattern is great for representing asynchronous results of processes that may or may not be completed yet, it cannot be used as a specification for an asynchronous computation and it’s inefficient for dealing with recursive loops. And speaking of recursive loops, @tailrec is great, but only works for self-recursive functions that do strict evaluation.

The Monix Task is in essence about dealing with asynchronous computations and non-determinism, being inspired by the Scalaz Task and designed from the ground up for performance and to be compatible with Scala.js/Javascript runtimes and with the Cats library. It also makes use of Scala’s Future to represent results, the two being complementary. And the Monix Coeval is the Task counterpart, helping you in dealing with lazy values that can be evaluated synchronously, without the danger of having your call-stack overflow.

In this talk I’ll show you its design, about when you should use Task or Coeval and why they are better in dealing with asynchronicity and recursivity. And even though this presentation talks about a specific implementation, the concepts are portable.

BIO: Alexandru is a software developer living in Bucharest, Romania, currently working for Eloquentix. A startup guy, by day he’s been helping with projects for powering the next generation energy grid solutions and for advancing the health-care industry. By night he’s fueled by his work on the Monix project, the Scala library for composing asynchronous and event-based programs. He’s also a proud father, husband, has a very unhealthy sleep schedule and appreciates talking about programming over beer. Sometimes he blogs at https://bionicspirit.com .

Photo of Bucharest Scala group
Bucharest Scala
See more events
Eloquentix
Șelari, 17 · Bucharest