Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Easy Static Checking for Embedded DSLs in Scala with Contextual

Scala Days Conferences via YouTube

Overview

Explore compile-time checking for embedded domain-specific languages (DSLs) in Scala using the Contextual library in this Scala Days Copenhagen 2017 conference talk. Learn how to create string interpolators that perform parsing and validation at compile-time without writing macros. Discover techniques for implementing custom error messages and adding compile-time safety to Scala code. Dive into practical examples of creating literal-like types for email addresses, URLs, YAML, CSS, and even Haskell. Gain insights into the TyperAPI, extension methods, and the inner workings of Contextual. Follow along with demonstrations of various interpolators, including ObjectID, CSS, and XML examples. Understand how to leverage Contextual for parsing, validation, and creating custom literal types to enhance code safety and expressiveness in Scala projects.

Syllabus

Introduction
What is Contextual
Why Contextual interrupts are boring
The Typer
Why is it true
How does it work
Extension Methods
Revisiting Extension Methods
Contextual
Examples
Embedding in Scala
Writing Interpolators
Haskell
Regular Expressions
Use of Facing Messages
Contextual Interpolators
Object
ID
CSS Interpolator
A horrible abomination
XML
XML Example
Xylophone
compile error
check tags
embed name
preview
embed type class
check string content
assign context
pass position
create object
extension field
literals method
parses method
dissect URL
create case object
compile
substitution
input types
version number

Taught by

Scala Days Conferences

Reviews

Start your review of Easy Static Checking for Embedded DSLs in Scala with Contextual

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.