Skip to content
Episode 44

Details

Macro-based smart constructorsMark Hopkins

Smart constructors are a nice pattern for building data types that need extra validation or calculation.

But in the case when we're building our data type from statically known values, they leave us with two annoyances:

• it's more clunky

• we have a run-time test for something that's known at compile time.

We'll investigate how Scala macros can help us address these problems while retaining safety.

What the hell is Lightbend?Christopher Hunt

Typesafe changed its name – and seemingly its focus – recently. What is the company set up by Scala creator Martin Odersky (along with Jonas Bonér and Paul Phillips) up to?

Pure Embedding of Dynamic ObjectsMax Leythaeuser

Scripting languages like Python, JavaScript, Ruby, Perl or Lua offer very flexible object semantics to the developer. On the one hand side, programmers can rely on classical object-oriented features, such as inheritance, encapsulation and polymorphism, and on the other, they are able to add and remove members from existing objects or merge them at any given point in their life-cycle.

This is usually not available in statically typed object-oriented languages. Imagine you have a client that wants to execute some behavior at a (core-) object of interest but that desired behavior is not available. Using inheritance, mixins and traits or adapting design-patterns is not desirable. The first three techniques will result in a very static system design and exponentially many classes, while the use of patterns often leads to object-schizophrenia and the need of additional management code. Adding and removing members from existing objects at runtime are indeed very useful operations for todays software-systems, that have a very high demand for adaptivity and need to cope with complexity and change.

Is bridging the gap between statically-typed, object-oriented languages and dynamic objects at runtime via pure embedding possible without too much effort?

To answer that, the main contributions of this talk are:

• An introduction and summarizing technological overview on SCROLL (https://github.com/max-leuthaeuser/SCROLL), a lightweight library that allows for pure embedding of dynamic objects in Scala, utilizing only those features that are available through its standard compiler. This library itself is small (∼1400 lines of code), allows for easy integration of legacy code and a high separation of concerns. It is limited on the side of type-safety as one might expect. Nevertheless, having a statically typed host language for dynamic objects supports the developer with the best of both worlds: static typing leads to an earlier detection of programming mistakes through static code analysis, better documentation in form of type-signatures, compiler-optimization, runtime efficiency and an improved design-time development experience, while the latter supports easy prototyping, change to unknown requirements or unpredictable data and application integration.

• An abstraction of that library into a more general implementation pattern by requiring only three fairly basic techniques to the host language.

• Some examples of course.

Photo of ScalaSyd group
ScalaSyd
See more events
Atlassian Headquarters
Level 6, 341 George St · Sydney