SlideShare a Scribd company logo
1 of 29
Download to read offline
Caprese
AdG project presentation
Martin Odersky
EPFL
Capabilities for Resources and Effects
Two areas where static typing has lagged behind
• Resources
• Effects
100’s of papers over 40 years, no large scale adoption yet.
Capabilities for Resources and Effects
Two areas where static typing has lagged behind
• Resources
• Effects
100’s of papers over 40 years, no large scale adoption yet.
Core Insights
• Resources and effects can be expressed as capabilities.
• Retained capabilities should be be tracked in types.
Resources
Values that are available only with
certain restrictions, such as
• lifetime
• sharing
• quantity
Examples
• regions of memory
• file handles
• channels
• database and network connections
...
Aspects of the computation beyond
shapes of inputs and outputs that we
want to track in types.
Examples
• updating variables
• throwing exceptions
• I/O
• suspending a computation
...
Effects
Resources and Effects in Programming
abstraction
compile-time tracking
?
20+M investment
Mozillla, ERC, …
?
Resources and Effects in Programming
abstraction
compile-time tracking
Linear Haskell
Singularity
Mezzo
Alias types
Algebraic effects
20+M investment
Mozillla, ERC, …
?
Resources and Effects in Programming
abstraction
compile-time tracking
Caprese
20+M investment
Mozillla, ERC, …
?
The Effect Polymorphism Problem
Unlike other types, effects are transitive:
The effects of f1 include the effects of the functions it calls, transitively.
How to describe the effects of f1 the call graph is dynamic?
 Effect polymorphism problem
I/O
f1 f2 … fn throw Exc
x := y
await f()
Capabilities to the Rescue
Effects can be modeled with capabilities
For instance, the following are equivalent:
def f(): T throws E
def f()(using CanThrow[E]): T
Effect
Capability
Capabilities Solve Effect Polymorphism
For instance, consider map on List[A]:
def map[B](f: A => B): List[B]
Capabilities Solve Effect Polymorphism
For instance, consider map on List[A]:
def map[B](f: A => B): List[B]
With traditional effect systems:
def map[B, E](f: A -> B eff E): List[B] eff E
Capabilities Solve Effect Polymorphism
For instance, consider map on List[A]:
def map[B](f: A => B): List[B]
With traditional effect systems:
def map[B, E](f: A -> B eff E): List[B] eff E
With capabilities:
def map[B](f: A => B): List[B]
Here A => B is the type of impure functions that can capture
any capability as a free variable. Compare with A -> B for pure functions.
Capabilities are Resources
A CanThrow[E] capability is generated by a try that catches E.
Example
class TooLarge extends Exception
def f(x: Int): Int throws TooLarge =
if x < limit then x * x else throw TooLarge()
val xs: List[Int] = …
try xs.map(f) // generates ct: CanThrow[TooLarge]
catch case ex: TooLarge => Nil
The capability has limited lifetime: When the try exits, the capability can no
longer be used.
Capabilities are Resources
A CanThrow[E] capability is generated by a try that catches E.
Example
class TooLarge extends Exception
def f(x: Int)(using CanThrow[TooLarge]): Int
if x < limit then x * x else throw TooLarge()
val xs: List[Int] = …
try xs.map(f(_)(using CanThrow[TooLarge]))
catch case ex: TooLarge => Nil
The capability has limited lifetime: When the try exits, the capability can no
longer be used.
Scoped Capabilities
The following program still throws an unhandled exception:
val it =
try xs.iterator.map(f)
catch case TooLarge => Iterator.empty
it.next()
To rule out this program statically, we need ways to enforce resource
restrictions in the type system.
Core idea: Track in a type which capabilities can be captured
by its instances.
Capabilities and Capturing Types
Definition: A capturing type {c1,...,cn}T consists of a type T and a capture set of
capabilities {c1,...,cn}that tracks references retained by values of type T.
Definition: A capability is a reference of a capturing type with a non-empty
capture set.
• Every capability gets its authority from some other, more sweeping
capability which it captures.
• There is a root capability from which ultimately all others are derived.
Type-systematic description of the object-capability model.
Details in: Odersky, Boruch Gruszecki, Lee, Brachthäuser, Lhotak: Scoped
Capabilities for Polymorphic Effects, Arxiv 2207.03402
Capture Calculus:
A formalization of a
minimal core language
with statically tracked
capabilities
Point of Departure
Capture Calculus:
A formalization of a
minimal core language
with statically tracked
capabilities
Capture checker
prototype for a slightly
larger language subset
Point of Departure
Capture Calculus:
A formalization of a
minimal core language
with statically tracked
capabilities
Capture checker
prototype for a slightly
larger language subset
Point of Departure
Very promising in
the small, but can
we scale it up?
Project Structure
Caprese
Core
• Foundations
• Capture checking
Infrastructure
• Language integration
• Libraries
Applications
• Formal methods
• Efficient computing
• Distributed
• Security
Extensions
• Effect Domains
• Memory Safety
• Concurrency
Project Structure Challenges: Core
Caprese
Core
• Foundations
• Capture checking
Infrastructure
• Language integration
• Libraries
Applications
• Formal methods
• Efficient computing
• Distributed
• Security
Extensions
• Effect Domains
• Memory Safety
• Concurrency
• Can we extend the theory to
more language constructs that
are important in practice?
• Can we extend the theory to
resource restrictions other
than lifetime?
• Can we find sound and
effective inference algorithms?
Project Structure Challenges: Extensions
• Is capture checking expressive
enough to model a large range
of effect and resource usage
patterns?
• Can static checking help in
designing efficient and safe
memory systems and
concurrent runtimes?
Caprese
Core
• Foundations
• Capture checking
Infrastructure
• Language integration
• Libraries
Applications
• Formal methods
• Efficient computing
• Distributed
• Security
Extensions
• Effect Domains
• Memory Safety
• Concurrency
Project Structure Challenges: Infrastructure
Caprese
Core
• Foundations
• Capture checking
Infrastructure
• Language integration
• Libraries
Applications
• Formal methods
• Efficient computing
• Distributed
• Security
Extensions
• Effect Domains
• Memory Safety
• Concurrency
• Are capture annotations
lightweight enough to be used
widely in practice?
• Can capture checking be made
efficient enough to be always
on?
• Can error diagnostics be made
clear enough to be intelligible
for non-experts?
• How to migrate and
interoperate with existing
code?
Project Structure Challenges: Applications
Caprese
Core
• Foundations
• Capture checking
Infrastructure
• Language integration
• Libraries
Applications
• Formal methods
• Efficient computing
• Distributed
• Security
Extensions
• Effect Domains
• Memory Safety
• Concurrency
Can we validate the applicability
of the research in selected
application domains?
Language-based security
Project Structure Challenges: Applications
Caprese
Core
• Foundations
• Capture checking
Infrastructure
• Language integration
• Libraries
Applications
• Formal methods
• Efficient computing
• Distributed
• Security
Extensions
• Effect Domains
• Memory Safety
• Concurrency
Can we validate the applicability
of the research in selected
application domains?
Efficient computing
Project Structure Challenges: Applications
Caprese
Core
• Foundations
• Capture checking
Infrastructure
• Language integration
• Libraries
Applications
• Formal methods
• Efficient computing
• Distributed
• Security
Extensions
• Effect Domains
• Memory Safety
• Concurrency
Can we validate the applicability
of the research in selected
application domains?
Distributed systems
Project Structure Challenges: Applications
Caprese
Core
• Foundations
• Capture checking
Infrastructure
• Language integration
• Libraries
Applications
• Formal methods
• Efficient computing
• Distributed
• Security
Extensions
• Effect Domains
• Memory Safety
• Concurrency
Can we validate the applicability
of the research in selected
application domains?
Formal methods
Why Us?
To succeed, the project needs
• strong theoretical foundations,
• solid language implementation and tooling,
• a large educated user base for empirical evaluations.
Scala is unique in that it combines all three aspects.
Outlook
If successful, this work will solve several long-standing problems in programming:
• Effect polymorphism - getting flexibility without the overhead
• Mixing synchronous and asynchronous code
• Combining manual allocation and automatic GC
• Fearless concurrency, excluding data races and other hazards
It will lead to exciting new ways to model functional and imperative programming
as two ends of a spectrum.
It will be the key to combining without compromises
productivity, safety and performance.

More Related Content

Similar to odersky-adg-v5-220711161332-10853f8f.pdf

Exploring Elixir Codebases with Archeometer
Exploring Elixir Codebases with ArcheometerExploring Elixir Codebases with Archeometer
Exploring Elixir Codebases with ArcheometerAgustin Ramos
 
"Data Provenance: Principles and Why it matters for BioMedical Applications"
"Data Provenance: Principles and Why it matters for BioMedical Applications""Data Provenance: Principles and Why it matters for BioMedical Applications"
"Data Provenance: Principles and Why it matters for BioMedical Applications"Pinar Alper
 
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...Jose Quesada (hiring)
 
Source-to-source transformations: Supporting tools and infrastructure
Source-to-source transformations: Supporting tools and infrastructureSource-to-source transformations: Supporting tools and infrastructure
Source-to-source transformations: Supporting tools and infrastructurekaveirious
 
Generative Software Development. Overview and Examples
Generative Software Development. Overview and ExamplesGenerative Software Development. Overview and Examples
Generative Software Development. Overview and ExamplesEelco Visser
 
Software Abstractions for Parallel Hardware
Software Abstractions for Parallel HardwareSoftware Abstractions for Parallel Hardware
Software Abstractions for Parallel HardwareJoel Falcou
 
Scalable and Cost-Effective Model-Based Software Verification and Testing
Scalable and Cost-Effective Model-Based Software Verification and TestingScalable and Cost-Effective Model-Based Software Verification and Testing
Scalable and Cost-Effective Model-Based Software Verification and TestingLionel Briand
 
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...InfinIT - Innovationsnetværket for it
 
(Costless) Software Abstractions for Parallel Architectures
(Costless) Software Abstractions for Parallel Architectures(Costless) Software Abstractions for Parallel Architectures
(Costless) Software Abstractions for Parallel ArchitecturesJoel Falcou
 
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVM
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVMVoxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVM
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVMManuel Bernhardt
 
From Pipelines to Refineries: Scaling Big Data Applications
From Pipelines to Refineries: Scaling Big Data ApplicationsFrom Pipelines to Refineries: Scaling Big Data Applications
From Pipelines to Refineries: Scaling Big Data ApplicationsDatabricks
 
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data PlatformsCassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data PlatformsDataStax Academy
 
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...waqarnabi
 
Presentation
PresentationPresentation
Presentationbutest
 
OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11OpenSAF Foundation
 
ESWC SS 2012 - Wednesday Tutorial Barry Norton: Building (Production) Semanti...
ESWC SS 2012 - Wednesday Tutorial Barry Norton: Building (Production) Semanti...ESWC SS 2012 - Wednesday Tutorial Barry Norton: Building (Production) Semanti...
ESWC SS 2012 - Wednesday Tutorial Barry Norton: Building (Production) Semanti...eswcsummerschool
 
The Road to Lambda - Mike Duigou
The Road to Lambda - Mike DuigouThe Road to Lambda - Mike Duigou
The Road to Lambda - Mike Duigoujaxconf
 
C-and-Cpp-Brochure-English. .
C-and-Cpp-Brochure-English.               .C-and-Cpp-Brochure-English.               .
C-and-Cpp-Brochure-English. .spotguys705
 
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud DatabaseAzure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud DatabaseBizTalk360
 

Similar to odersky-adg-v5-220711161332-10853f8f.pdf (20)

Exploring Elixir Codebases with Archeometer
Exploring Elixir Codebases with ArcheometerExploring Elixir Codebases with Archeometer
Exploring Elixir Codebases with Archeometer
 
"Data Provenance: Principles and Why it matters for BioMedical Applications"
"Data Provenance: Principles and Why it matters for BioMedical Applications""Data Provenance: Principles and Why it matters for BioMedical Applications"
"Data Provenance: Principles and Why it matters for BioMedical Applications"
 
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
 
Source-to-source transformations: Supporting tools and infrastructure
Source-to-source transformations: Supporting tools and infrastructureSource-to-source transformations: Supporting tools and infrastructure
Source-to-source transformations: Supporting tools and infrastructure
 
Generative Software Development. Overview and Examples
Generative Software Development. Overview and ExamplesGenerative Software Development. Overview and Examples
Generative Software Development. Overview and Examples
 
Software Abstractions for Parallel Hardware
Software Abstractions for Parallel HardwareSoftware Abstractions for Parallel Hardware
Software Abstractions for Parallel Hardware
 
Scalable and Cost-Effective Model-Based Software Verification and Testing
Scalable and Cost-Effective Model-Based Software Verification and TestingScalable and Cost-Effective Model-Based Software Verification and Testing
Scalable and Cost-Effective Model-Based Software Verification and Testing
 
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
 
(Costless) Software Abstractions for Parallel Architectures
(Costless) Software Abstractions for Parallel Architectures(Costless) Software Abstractions for Parallel Architectures
(Costless) Software Abstractions for Parallel Architectures
 
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVM
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVMVoxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVM
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVM
 
From Pipelines to Refineries: Scaling Big Data Applications
From Pipelines to Refineries: Scaling Big Data ApplicationsFrom Pipelines to Refineries: Scaling Big Data Applications
From Pipelines to Refineries: Scaling Big Data Applications
 
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data PlatformsCassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
 
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
 
Presentation
PresentationPresentation
Presentation
 
OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11
 
ESWC SS 2012 - Wednesday Tutorial Barry Norton: Building (Production) Semanti...
ESWC SS 2012 - Wednesday Tutorial Barry Norton: Building (Production) Semanti...ESWC SS 2012 - Wednesday Tutorial Barry Norton: Building (Production) Semanti...
ESWC SS 2012 - Wednesday Tutorial Barry Norton: Building (Production) Semanti...
 
Return oriented programming (ROP)
Return oriented programming (ROP)Return oriented programming (ROP)
Return oriented programming (ROP)
 
The Road to Lambda - Mike Duigou
The Road to Lambda - Mike DuigouThe Road to Lambda - Mike Duigou
The Road to Lambda - Mike Duigou
 
C-and-Cpp-Brochure-English. .
C-and-Cpp-Brochure-English.               .C-and-Cpp-Brochure-English.               .
C-and-Cpp-Brochure-English. .
 
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud DatabaseAzure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
 

Recently uploaded

Beyond Numbers A Holistic Approach to Forensic Accounting
Beyond Numbers A Holistic Approach to Forensic AccountingBeyond Numbers A Holistic Approach to Forensic Accounting
Beyond Numbers A Holistic Approach to Forensic AccountingYourLegal Accounting
 
Sex service available my WhatsApp number 7374088497
Sex service available my WhatsApp number 7374088497Sex service available my WhatsApp number 7374088497
Sex service available my WhatsApp number 7374088497dipikakk482
 
Mental Health Issues of Graduate Students
Mental Health Issues of Graduate StudentsMental Health Issues of Graduate Students
Mental Health Issues of Graduate Studentsvineshkumarsajnani12
 
Presentation4 (2) survey responses clearly labelled
Presentation4 (2) survey responses clearly labelledPresentation4 (2) survey responses clearly labelled
Presentation4 (2) survey responses clearly labelledCaitlinCummins3
 
Moradia Isolada com Logradouro; Detached house with patio in Penacova
Moradia Isolada com Logradouro; Detached house with patio in PenacovaMoradia Isolada com Logradouro; Detached house with patio in Penacova
Moradia Isolada com Logradouro; Detached house with patio in Penacovaimostorept
 
Chapter 2 Organization Structure of a Treasury
Chapter 2 Organization Structure of a TreasuryChapter 2 Organization Structure of a Treasury
Chapter 2 Organization Structure of a TreasurySarunChhetri1
 
obat aborsi jakarta wa 081336238223 jual obat aborsi cytotec asli di jakarta9...
obat aborsi jakarta wa 081336238223 jual obat aborsi cytotec asli di jakarta9...obat aborsi jakarta wa 081336238223 jual obat aborsi cytotec asli di jakarta9...
obat aborsi jakarta wa 081336238223 jual obat aborsi cytotec asli di jakarta9...yulianti213969
 
The Art of Decision-Making: Navigating Complexity and Uncertainty
The Art of Decision-Making: Navigating Complexity and UncertaintyThe Art of Decision-Making: Navigating Complexity and Uncertainty
The Art of Decision-Making: Navigating Complexity and Uncertaintycapivisgroup
 
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdfProgress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdfHolger Mueller
 
SCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjw
SCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjwSCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjw
SCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjwadimosmejiaslendon
 
00971508021841 حبوب الإجهاض في دبي | أبوظبي | الشارقة | السطوة |❇ ❈ ((![© ر
00971508021841 حبوب الإجهاض في دبي | أبوظبي | الشارقة | السطوة |❇ ❈ ((![©  ر00971508021841 حبوب الإجهاض في دبي | أبوظبي | الشارقة | السطوة |❇ ❈ ((![©  ر
00971508021841 حبوب الإجهاض في دبي | أبوظبي | الشارقة | السطوة |❇ ❈ ((![© رnafizanafzal
 
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg PfizerJual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg PfizerPusat Herbal
 
Navigating Tax Season with Confidence Streamlines CPA Firms
Navigating Tax Season with Confidence Streamlines CPA FirmsNavigating Tax Season with Confidence Streamlines CPA Firms
Navigating Tax Season with Confidence Streamlines CPA FirmsYourLegal Accounting
 
Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...
Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...
Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...CIO Look Magazine
 
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证ogawka
 
Unlocking Growth The Power of Outsourcing for CPA Firms
Unlocking Growth The Power of Outsourcing for CPA FirmsUnlocking Growth The Power of Outsourcing for CPA Firms
Unlocking Growth The Power of Outsourcing for CPA FirmsYourLegal Accounting
 
wagamamaLab presentation @MIT 20240509 IRODORI
wagamamaLab presentation @MIT 20240509 IRODORIwagamamaLab presentation @MIT 20240509 IRODORI
wagamamaLab presentation @MIT 20240509 IRODORIIRODORI inc.
 

Recently uploaded (20)

Obat Aborsi Malang 0851\7696\3835 Jual Obat Cytotec Di Malang
Obat Aborsi Malang 0851\7696\3835 Jual Obat Cytotec Di MalangObat Aborsi Malang 0851\7696\3835 Jual Obat Cytotec Di Malang
Obat Aborsi Malang 0851\7696\3835 Jual Obat Cytotec Di Malang
 
Beyond Numbers A Holistic Approach to Forensic Accounting
Beyond Numbers A Holistic Approach to Forensic AccountingBeyond Numbers A Holistic Approach to Forensic Accounting
Beyond Numbers A Holistic Approach to Forensic Accounting
 
Sex service available my WhatsApp number 7374088497
Sex service available my WhatsApp number 7374088497Sex service available my WhatsApp number 7374088497
Sex service available my WhatsApp number 7374088497
 
Mental Health Issues of Graduate Students
Mental Health Issues of Graduate StudentsMental Health Issues of Graduate Students
Mental Health Issues of Graduate Students
 
Presentation4 (2) survey responses clearly labelled
Presentation4 (2) survey responses clearly labelledPresentation4 (2) survey responses clearly labelled
Presentation4 (2) survey responses clearly labelled
 
Moradia Isolada com Logradouro; Detached house with patio in Penacova
Moradia Isolada com Logradouro; Detached house with patio in PenacovaMoradia Isolada com Logradouro; Detached house with patio in Penacova
Moradia Isolada com Logradouro; Detached house with patio in Penacova
 
Chapter 2 Organization Structure of a Treasury
Chapter 2 Organization Structure of a TreasuryChapter 2 Organization Structure of a Treasury
Chapter 2 Organization Structure of a Treasury
 
Obat Aborsi Bandung 0851\7696\3835 Jual Obat Cytotec Di Bandung
Obat Aborsi Bandung 0851\7696\3835 Jual Obat Cytotec Di BandungObat Aborsi Bandung 0851\7696\3835 Jual Obat Cytotec Di Bandung
Obat Aborsi Bandung 0851\7696\3835 Jual Obat Cytotec Di Bandung
 
obat aborsi jakarta wa 081336238223 jual obat aborsi cytotec asli di jakarta9...
obat aborsi jakarta wa 081336238223 jual obat aborsi cytotec asli di jakarta9...obat aborsi jakarta wa 081336238223 jual obat aborsi cytotec asli di jakarta9...
obat aborsi jakarta wa 081336238223 jual obat aborsi cytotec asli di jakarta9...
 
The Art of Decision-Making: Navigating Complexity and Uncertainty
The Art of Decision-Making: Navigating Complexity and UncertaintyThe Art of Decision-Making: Navigating Complexity and Uncertainty
The Art of Decision-Making: Navigating Complexity and Uncertainty
 
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdfProgress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
Progress Report - UKG Analyst Summit 2024 - A lot to do - Good Progress1-1.pdf
 
SCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjw
SCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjwSCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjw
SCI9-Q4-MOD8.1.pdfjttstwjwetw55k5wwtwrjw
 
00971508021841 حبوب الإجهاض في دبي | أبوظبي | الشارقة | السطوة |❇ ❈ ((![© ر
00971508021841 حبوب الإجهاض في دبي | أبوظبي | الشارقة | السطوة |❇ ❈ ((![©  ر00971508021841 حبوب الإجهاض في دبي | أبوظبي | الشارقة | السطوة |❇ ❈ ((![©  ر
00971508021841 حبوب الإجهاض في دبي | أبوظبي | الشارقة | السطوة |❇ ❈ ((![© ر
 
WAM Corporate Presentation May 2024_w.pdf
WAM Corporate Presentation May 2024_w.pdfWAM Corporate Presentation May 2024_w.pdf
WAM Corporate Presentation May 2024_w.pdf
 
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg PfizerJual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
Jual Obat Aborsi Di Sibolga wa 0851/7541/5434 Cytotec Misoprostol 200mcg Pfizer
 
Navigating Tax Season with Confidence Streamlines CPA Firms
Navigating Tax Season with Confidence Streamlines CPA FirmsNavigating Tax Season with Confidence Streamlines CPA Firms
Navigating Tax Season with Confidence Streamlines CPA Firms
 
Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...
Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...
Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...
 
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
 
Unlocking Growth The Power of Outsourcing for CPA Firms
Unlocking Growth The Power of Outsourcing for CPA FirmsUnlocking Growth The Power of Outsourcing for CPA Firms
Unlocking Growth The Power of Outsourcing for CPA Firms
 
wagamamaLab presentation @MIT 20240509 IRODORI
wagamamaLab presentation @MIT 20240509 IRODORIwagamamaLab presentation @MIT 20240509 IRODORI
wagamamaLab presentation @MIT 20240509 IRODORI
 

odersky-adg-v5-220711161332-10853f8f.pdf

  • 2. Capabilities for Resources and Effects Two areas where static typing has lagged behind • Resources • Effects 100’s of papers over 40 years, no large scale adoption yet.
  • 3. Capabilities for Resources and Effects Two areas where static typing has lagged behind • Resources • Effects 100’s of papers over 40 years, no large scale adoption yet. Core Insights • Resources and effects can be expressed as capabilities. • Retained capabilities should be be tracked in types.
  • 4. Resources Values that are available only with certain restrictions, such as • lifetime • sharing • quantity Examples • regions of memory • file handles • channels • database and network connections ... Aspects of the computation beyond shapes of inputs and outputs that we want to track in types. Examples • updating variables • throwing exceptions • I/O • suspending a computation ... Effects
  • 5. Resources and Effects in Programming abstraction compile-time tracking ? 20+M investment Mozillla, ERC, … ?
  • 6. Resources and Effects in Programming abstraction compile-time tracking Linear Haskell Singularity Mezzo Alias types Algebraic effects 20+M investment Mozillla, ERC, … ?
  • 7. Resources and Effects in Programming abstraction compile-time tracking Caprese 20+M investment Mozillla, ERC, … ?
  • 8. The Effect Polymorphism Problem Unlike other types, effects are transitive: The effects of f1 include the effects of the functions it calls, transitively. How to describe the effects of f1 the call graph is dynamic?  Effect polymorphism problem I/O f1 f2 … fn throw Exc x := y await f()
  • 9. Capabilities to the Rescue Effects can be modeled with capabilities For instance, the following are equivalent: def f(): T throws E def f()(using CanThrow[E]): T Effect Capability
  • 10. Capabilities Solve Effect Polymorphism For instance, consider map on List[A]: def map[B](f: A => B): List[B]
  • 11. Capabilities Solve Effect Polymorphism For instance, consider map on List[A]: def map[B](f: A => B): List[B] With traditional effect systems: def map[B, E](f: A -> B eff E): List[B] eff E
  • 12. Capabilities Solve Effect Polymorphism For instance, consider map on List[A]: def map[B](f: A => B): List[B] With traditional effect systems: def map[B, E](f: A -> B eff E): List[B] eff E With capabilities: def map[B](f: A => B): List[B] Here A => B is the type of impure functions that can capture any capability as a free variable. Compare with A -> B for pure functions.
  • 13. Capabilities are Resources A CanThrow[E] capability is generated by a try that catches E. Example class TooLarge extends Exception def f(x: Int): Int throws TooLarge = if x < limit then x * x else throw TooLarge() val xs: List[Int] = … try xs.map(f) // generates ct: CanThrow[TooLarge] catch case ex: TooLarge => Nil The capability has limited lifetime: When the try exits, the capability can no longer be used.
  • 14. Capabilities are Resources A CanThrow[E] capability is generated by a try that catches E. Example class TooLarge extends Exception def f(x: Int)(using CanThrow[TooLarge]): Int if x < limit then x * x else throw TooLarge() val xs: List[Int] = … try xs.map(f(_)(using CanThrow[TooLarge])) catch case ex: TooLarge => Nil The capability has limited lifetime: When the try exits, the capability can no longer be used.
  • 15. Scoped Capabilities The following program still throws an unhandled exception: val it = try xs.iterator.map(f) catch case TooLarge => Iterator.empty it.next() To rule out this program statically, we need ways to enforce resource restrictions in the type system. Core idea: Track in a type which capabilities can be captured by its instances.
  • 16. Capabilities and Capturing Types Definition: A capturing type {c1,...,cn}T consists of a type T and a capture set of capabilities {c1,...,cn}that tracks references retained by values of type T. Definition: A capability is a reference of a capturing type with a non-empty capture set. • Every capability gets its authority from some other, more sweeping capability which it captures. • There is a root capability from which ultimately all others are derived. Type-systematic description of the object-capability model. Details in: Odersky, Boruch Gruszecki, Lee, Brachthäuser, Lhotak: Scoped Capabilities for Polymorphic Effects, Arxiv 2207.03402
  • 17. Capture Calculus: A formalization of a minimal core language with statically tracked capabilities Point of Departure
  • 18. Capture Calculus: A formalization of a minimal core language with statically tracked capabilities Capture checker prototype for a slightly larger language subset Point of Departure
  • 19. Capture Calculus: A formalization of a minimal core language with statically tracked capabilities Capture checker prototype for a slightly larger language subset Point of Departure Very promising in the small, but can we scale it up?
  • 20. Project Structure Caprese Core • Foundations • Capture checking Infrastructure • Language integration • Libraries Applications • Formal methods • Efficient computing • Distributed • Security Extensions • Effect Domains • Memory Safety • Concurrency
  • 21. Project Structure Challenges: Core Caprese Core • Foundations • Capture checking Infrastructure • Language integration • Libraries Applications • Formal methods • Efficient computing • Distributed • Security Extensions • Effect Domains • Memory Safety • Concurrency • Can we extend the theory to more language constructs that are important in practice? • Can we extend the theory to resource restrictions other than lifetime? • Can we find sound and effective inference algorithms?
  • 22. Project Structure Challenges: Extensions • Is capture checking expressive enough to model a large range of effect and resource usage patterns? • Can static checking help in designing efficient and safe memory systems and concurrent runtimes? Caprese Core • Foundations • Capture checking Infrastructure • Language integration • Libraries Applications • Formal methods • Efficient computing • Distributed • Security Extensions • Effect Domains • Memory Safety • Concurrency
  • 23. Project Structure Challenges: Infrastructure Caprese Core • Foundations • Capture checking Infrastructure • Language integration • Libraries Applications • Formal methods • Efficient computing • Distributed • Security Extensions • Effect Domains • Memory Safety • Concurrency • Are capture annotations lightweight enough to be used widely in practice? • Can capture checking be made efficient enough to be always on? • Can error diagnostics be made clear enough to be intelligible for non-experts? • How to migrate and interoperate with existing code?
  • 24. Project Structure Challenges: Applications Caprese Core • Foundations • Capture checking Infrastructure • Language integration • Libraries Applications • Formal methods • Efficient computing • Distributed • Security Extensions • Effect Domains • Memory Safety • Concurrency Can we validate the applicability of the research in selected application domains? Language-based security
  • 25. Project Structure Challenges: Applications Caprese Core • Foundations • Capture checking Infrastructure • Language integration • Libraries Applications • Formal methods • Efficient computing • Distributed • Security Extensions • Effect Domains • Memory Safety • Concurrency Can we validate the applicability of the research in selected application domains? Efficient computing
  • 26. Project Structure Challenges: Applications Caprese Core • Foundations • Capture checking Infrastructure • Language integration • Libraries Applications • Formal methods • Efficient computing • Distributed • Security Extensions • Effect Domains • Memory Safety • Concurrency Can we validate the applicability of the research in selected application domains? Distributed systems
  • 27. Project Structure Challenges: Applications Caprese Core • Foundations • Capture checking Infrastructure • Language integration • Libraries Applications • Formal methods • Efficient computing • Distributed • Security Extensions • Effect Domains • Memory Safety • Concurrency Can we validate the applicability of the research in selected application domains? Formal methods
  • 28. Why Us? To succeed, the project needs • strong theoretical foundations, • solid language implementation and tooling, • a large educated user base for empirical evaluations. Scala is unique in that it combines all three aspects.
  • 29. Outlook If successful, this work will solve several long-standing problems in programming: • Effect polymorphism - getting flexibility without the overhead • Mixing synchronous and asynchronous code • Combining manual allocation and automatic GC • Fearless concurrency, excluding data races and other hazards It will lead to exciting new ways to model functional and imperative programming as two ends of a spectrum. It will be the key to combining without compromises productivity, safety and performance.