SlideShare uma empresa Scribd logo
1 de 47
Baixar para ler offline
TypePlug -- Practical, Pluggable Types

      Marcus Denker
      with:
      Nik Haldiman
      Oscar Nierstrasz

                  University of Bern




© Marcus Denker
Types?



© Marcus Denker
Caveat....



© Marcus Denker
I am not a Type Person



© Marcus Denker
© Marcus Denker
Static types are Evil



© Marcus Denker
© Marcus Denker
© Marcus Denker
© Marcus Denker
© Marcus Denker
Static types are Evil?



© Marcus Denker
Static is Evil!



© Marcus Denker
The Future....



© Marcus Denker
...change



© Marcus Denker
...evolution



© Marcus Denker
...dynamic



© Marcus Denker
...biological



© Marcus Denker
Static typing is Good!




>    Programs with failures are rejected
     — Reduces errors detected at runtime

>    Documentation

>    Minor inconvenience, major payoff




© Marcus Denker
Static typing is Evil!



>    Exactly all cool programs are rejected
     — Reflection?!


>    Inconvenience is not at all “minor”
     — Typed programs hard to change + evolve

>    Only the most trivial errors are detected
     — We would have found those anyway before deployment




© Marcus Denker
Is it possible to have one’s cake and eat it, too?
History: Strongtalk


>    Anymorphic. Startup (ca. 1996)
     — Self team, from Sun
     — Smalltalk VM

>    Smalltalk with a Type System

>    Observations:
     — Types not needed for performance
     — Optional Types are nice (Documentation!)
           –      Can be introduced later when the system is stable



© Marcus Denker
Problem of Mandatory Types



>    Types constrain the expressiveness of a Language

>    Types make systems more brittle
     — Security and Performance
     — If types fail, behavior is undefined

>    But Type-Systems are proven to be correct!?
     — Real world is too complex to formalize
     — Implementation will have bugs



© Marcus Denker
Pluggable Types



>    Optional: do not change the semantics



>    Pluggable: many different ones
     — Especially exotic type-systems



>    “Type-Systems as Tools”
                                        Gilad Bracha, OOPSLA 04:
                                        Pluggable Type-Systems

© Marcus Denker
Pluggable Types: Language


>    Optional types do not constrain the expressiveness
     — We can ignore the type system if we want
     — (or turn it off completely)



>    New language models can be realized faster


>    Inventing the Future is hard if it needs to be type-save
     — Example: NewSpeak


© Marcus Denker
Pluggable Types: Pluggability



>    There is a lot of very interesting research on Types

>    It is very hard to get it into the hands of Programmers

     — Sun will not change Java for you!
     — (even though you suffered with java for years for your research)

>    Pluggable type-systems free type research from
     language adoption!


© Marcus Denker
Pluggable Types: Types as Tools


                                  Type Checker




                             We are free to explore
                             the unthinkable in our
                             Room

                                     (Research!)



© Marcus Denker
Type Inference?


>    Isnʼt Type Inference enough?

>    Type Inference is cool. But itʼs a Type-system

>    No Type Annotation != No Type System



             Pluggable Types are very likely to use Inference



© Marcus Denker
Pluggable Types at SCG


>    Research about Software Evolution

     — Reflection to support dynamic change



>    We like to use dynamically typed systems
     — Smalltalk / Squeak

>    Thinking is not constrained by Types
     — Very important!


© Marcus Denker
Methods and Reflection



>    Method are Objects
     — e.g in Smalltalk


>    No high-level model for sub-method elements
     — Message sends
     — Assignments
     — Variable access


>    Structural reflection stops at the granularity of methods


© Marcus Denker                                                 30
Sub-Method Reflection



>    Many tools work on sub method level
     — Profiler, Refactoring Tool, Debugger, Type Checker

>    Communication between tools needed
     — example: Code coverage

>    All tools use different representations
     — Tools are harder to build
     — Communication not possible


© Marcus Denker
Sub-Method Reflection



                               >   Sub-method Structure
   :ReflectiveMethod                (AST)
                  annotation
                               >   Annotations
                                   — Source visible
                  annotation       — non-visible

                               >   Causally connected



© Marcus Denker
Sub-Method Reflection: Behavior




                                 meta-object


links
> Sub-method Reflection           activation
                                 condition
                                 source code
                                    (AST)


© Marcus Denker
Sub-Method Reflection: Annotations



>    Source visible annotations
                  (9 raisedTo: 10000) <:evaluateAtCompiletime:>


> Every node can be annotated
> Semantics: Compiler Plugins



>    Type Annotations?


© Marcus Denker
TypePlug



>    Pluggable types for Squeak

>    Based on sub-method reflection framework

>    Case-Studies:
     — Non-Nil Types
     — Class Based Types
     — Confined Types              Master Thesis:
                                   Nik Haldiman

© Marcus Denker
The Problem




>    Large, untyped code-base

>    Overhead for using pluggable types is high

     — Existing code needs to be annotated with type information




© Marcus Denker
Example: Non-Nil Type-System



>    Declare variables to never be nil


Object subclass: #Line
   typedInstanceVariables: ’startPoint endPoint <:nonNil:>’
   typedClassVariables: ’’
   poolDictionaries: ''
   category: 'Demo'




© Marcus Denker
Non-Nil Type-System




moveHorizontally: anInteger

  startPoint := self movePoint: startPoint
                    horizontally: anInteger.

  endPoint:=self movePoint: endPoint
                 horizontally: anInteger




  © Marcus Denker
Non-Nil Type-System




moveHorizontally: anInteger

  startPoint := self movePoint: startPoint
                    horizontally: anInteger.

  endPoint:=self movePoint: endPoint
                 horizontally: anInteger <- type ’TopType’ of
  expression is not compatible with type ’nonNil’ of variable
  ’endPoint’.

     




  © Marcus Denker
Non-Nil Type-System




movePoint: aPoint horizontally: anInteger


            
        ↑ (aPoint addX: anInteger y: 0) <:nonNil :>




    © Marcus Denker
The Problem (repeat)




>    Large, untyped code-base

>    Overhead for using pluggable types is high

     — Existing code needs to be annotated with type information




© Marcus Denker
Solution



>    Only type-check annotated code

>    Use type-inference to infer types of non-annotated code

>    Explicit type-casts

>    Allow external annotations for foreign code



© Marcus Denker
External Type Annotations


>    We need to annotate existing code
     — Especially libraries and frameworks
     — Example: Object>>#hash is <: nonNil :>

>    We do not want to change the program code!

>    Solution: External Type Annotations
     — Added and modified in the TypesBrowser
     — Do not change the source
     — External representation: Type Packages


© Marcus Denker
Browser




© Marcus Denker
Future Work




>    Improve Type-Inference
     — Better algorithms
     — Explore heuristical type inference

>    Type Checking and Reflection
     — Use pluggable types to check reflective change




© Marcus Denker
Conclusion




>    Pluggable Types
     — All positive effects of static types
     — Avoid the problems


>    TypePlug: Pragmatic framework for Pluggable Types
     — Example in the context of Smalltalk/Squeak




© Marcus Denker
Conclusion




>    Pluggable Types
     — All positive effects of static types
     — Avoid the problems


>    TypePlug: Pragmatic framework for Pluggable Types
     — Example in the context of Smalltalk/Squeak


                                              Questions?
© Marcus Denker

Mais conteúdo relacionado

Semelhante a Talk: Practical, Pluggable Types

TypePlug -- Practical, Pluggable Types
TypePlug -- Practical, Pluggable TypesTypePlug -- Practical, Pluggable Types
TypePlug -- Practical, Pluggable TypesESUG
 
The Reflectivity
The ReflectivityThe Reflectivity
The ReflectivityESUG
 
Beyond Text - Methods as Objects
Beyond Text - Methods as ObjectsBeyond Text - Methods as Objects
Beyond Text - Methods as ObjectsMarcus Denker
 
Sub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral ReflectionSub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral ReflectionMarcus Denker
 
Software Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience ReportSoftware Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience ReportMarcus Denker
 
Reflection and Context
Reflection and ContextReflection and Context
Reflection and ContextMarcus Denker
 
Sub-Method Reflection
Sub-Method ReflectionSub-Method Reflection
Sub-Method ReflectionMarcus Denker
 
Unanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionUnanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionESUG
 
Modeling on the Web
Modeling on the WebModeling on the Web
Modeling on the WebIcinetic
 
Finding balance of DDD while your application grows
Finding balance of DDD while your application growsFinding balance of DDD while your application grows
Finding balance of DDD while your application growsCarolina Karklis
 

Semelhante a Talk: Practical, Pluggable Types (20)

TypePlug -- Practical, Pluggable Types
TypePlug -- Practical, Pluggable TypesTypePlug -- Practical, Pluggable Types
TypePlug -- Practical, Pluggable Types
 
Lecture: Reflection
Lecture: ReflectionLecture: Reflection
Lecture: Reflection
 
Demo: Reflectivity
Demo: ReflectivityDemo: Reflectivity
Demo: Reflectivity
 
The Reflectivity
The ReflectivityThe Reflectivity
The Reflectivity
 
Reflection
ReflectionReflection
Reflection
 
Reflectivity Demo
Reflectivity DemoReflectivity Demo
Reflectivity Demo
 
Lecture: Reflection
Lecture: ReflectionLecture: Reflection
Lecture: Reflection
 
Beyond Text - Methods as Objects
Beyond Text - Methods as ObjectsBeyond Text - Methods as Objects
Beyond Text - Methods as Objects
 
Sub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral ReflectionSub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral Reflection
 
Refactoring
RefactoringRefactoring
Refactoring
 
Software Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience ReportSoftware Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience Report
 
Reflection and Context
Reflection and ContextReflection and Context
Reflection and Context
 
Sub-Method Reflection
Sub-Method ReflectionSub-Method Reflection
Sub-Method Reflection
 
Unanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionUnanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral Reflection
 
Unstuck
UnstuckUnstuck
Unstuck
 
Modeling on the Web
Modeling on the WebModeling on the Web
Modeling on the Web
 
Modeling on the Web
Modeling on the WebModeling on the Web
Modeling on the Web
 
08 refactoring
08 refactoring08 refactoring
08 refactoring
 
01_IT4557.pptx
01_IT4557.pptx01_IT4557.pptx
01_IT4557.pptx
 
Finding balance of DDD while your application grows
Finding balance of DDD while your application growsFinding balance of DDD while your application grows
Finding balance of DDD while your application grows
 

Mais de Marcus Denker

ConstantBlocks in Pharo11
ConstantBlocks in Pharo11ConstantBlocks in Pharo11
ConstantBlocks in Pharo11Marcus Denker
 
First Class Variables as AST Annotations
First Class Variables as AST AnnotationsFirst Class Variables as AST Annotations
First Class Variables as AST AnnotationsMarcus Denker
 
Supporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo SupportSupporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo SupportMarcus Denker
 
Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Marcus Denker
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerMarcus Denker
 
Lecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksLecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksMarcus Denker
 
Improving code completion for Pharo
Improving code completion for PharoImproving code completion for Pharo
Improving code completion for PharoMarcus Denker
 
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinksVUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinksMarcus Denker
 
Lecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinksLecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinksMarcus Denker
 
Open-Source: An Infinite Game
Open-Source: An Infinite GameOpen-Source: An Infinite Game
Open-Source: An Infinite GameMarcus Denker
 
PharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to PharoPharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to PharoMarcus Denker
 
Feedback Loops in Practice
Feedback Loops in PracticeFeedback Loops in Practice
Feedback Loops in PracticeMarcus Denker
 

Mais de Marcus Denker (20)

Soil And Pharo
Soil And PharoSoil And Pharo
Soil And Pharo
 
ConstantBlocks in Pharo11
ConstantBlocks in Pharo11ConstantBlocks in Pharo11
ConstantBlocks in Pharo11
 
Demo: Improved DoIt
Demo: Improved DoItDemo: Improved DoIt
Demo: Improved DoIt
 
First Class Variables as AST Annotations
First Class Variables as AST AnnotationsFirst Class Variables as AST Annotations
First Class Variables as AST Annotations
 
Supporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo SupportSupporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo Support
 
Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Variables in Pharo
Variables in PharoVariables in Pharo
Variables in Pharo
 
Lecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksLecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinks
 
Improving code completion for Pharo
Improving code completion for PharoImproving code completion for Pharo
Improving code completion for Pharo
 
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinksVUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
 
Slot Composition
Slot CompositionSlot Composition
Slot Composition
 
Lecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinksLecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinks
 
PHARO IOT
PHARO IOTPHARO IOT
PHARO IOT
 
Open-Source: An Infinite Game
Open-Source: An Infinite GameOpen-Source: An Infinite Game
Open-Source: An Infinite Game
 
Lecture: MetaLinks
Lecture: MetaLinksLecture: MetaLinks
Lecture: MetaLinks
 
PharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to PharoPharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to Pharo
 
Feedback Loops in Practice
Feedback Loops in PracticeFeedback Loops in Practice
Feedback Loops in Practice
 
Pharo6 - ESUG17
Pharo6 - ESUG17Pharo6 - ESUG17
Pharo6 - ESUG17
 
Pharo6
Pharo6Pharo6
Pharo6
 

Último

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Último (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Talk: Practical, Pluggable Types

  • 1. TypePlug -- Practical, Pluggable Types Marcus Denker with: Nik Haldiman Oscar Nierstrasz University of Bern © Marcus Denker
  • 4. I am not a Type Person © Marcus Denker
  • 6. Static types are Evil © Marcus Denker
  • 11. Static types are Evil? © Marcus Denker
  • 12. Static is Evil! © Marcus Denker
  • 18. Static typing is Good! > Programs with failures are rejected — Reduces errors detected at runtime > Documentation > Minor inconvenience, major payoff © Marcus Denker
  • 19. Static typing is Evil! > Exactly all cool programs are rejected — Reflection?! > Inconvenience is not at all “minor” — Typed programs hard to change + evolve > Only the most trivial errors are detected — We would have found those anyway before deployment © Marcus Denker
  • 20.
  • 21. Is it possible to have one’s cake and eat it, too?
  • 22. History: Strongtalk > Anymorphic. Startup (ca. 1996) — Self team, from Sun — Smalltalk VM > Smalltalk with a Type System > Observations: — Types not needed for performance — Optional Types are nice (Documentation!) – Can be introduced later when the system is stable © Marcus Denker
  • 23. Problem of Mandatory Types > Types constrain the expressiveness of a Language > Types make systems more brittle — Security and Performance — If types fail, behavior is undefined > But Type-Systems are proven to be correct!? — Real world is too complex to formalize — Implementation will have bugs © Marcus Denker
  • 24. Pluggable Types > Optional: do not change the semantics > Pluggable: many different ones — Especially exotic type-systems > “Type-Systems as Tools” Gilad Bracha, OOPSLA 04: Pluggable Type-Systems © Marcus Denker
  • 25. Pluggable Types: Language > Optional types do not constrain the expressiveness — We can ignore the type system if we want — (or turn it off completely) > New language models can be realized faster > Inventing the Future is hard if it needs to be type-save — Example: NewSpeak © Marcus Denker
  • 26. Pluggable Types: Pluggability > There is a lot of very interesting research on Types > It is very hard to get it into the hands of Programmers — Sun will not change Java for you! — (even though you suffered with java for years for your research) > Pluggable type-systems free type research from language adoption! © Marcus Denker
  • 27. Pluggable Types: Types as Tools Type Checker We are free to explore the unthinkable in our Room (Research!) © Marcus Denker
  • 28. Type Inference? > Isnʼt Type Inference enough? > Type Inference is cool. But itʼs a Type-system > No Type Annotation != No Type System Pluggable Types are very likely to use Inference © Marcus Denker
  • 29. Pluggable Types at SCG > Research about Software Evolution — Reflection to support dynamic change > We like to use dynamically typed systems — Smalltalk / Squeak > Thinking is not constrained by Types — Very important! © Marcus Denker
  • 30. Methods and Reflection > Method are Objects — e.g in Smalltalk > No high-level model for sub-method elements — Message sends — Assignments — Variable access > Structural reflection stops at the granularity of methods © Marcus Denker 30
  • 31. Sub-Method Reflection > Many tools work on sub method level — Profiler, Refactoring Tool, Debugger, Type Checker > Communication between tools needed — example: Code coverage > All tools use different representations — Tools are harder to build — Communication not possible © Marcus Denker
  • 32. Sub-Method Reflection > Sub-method Structure :ReflectiveMethod (AST) annotation > Annotations — Source visible annotation — non-visible > Causally connected © Marcus Denker
  • 33. Sub-Method Reflection: Behavior meta-object links > Sub-method Reflection activation condition source code (AST) © Marcus Denker
  • 34. Sub-Method Reflection: Annotations > Source visible annotations (9 raisedTo: 10000) <:evaluateAtCompiletime:> > Every node can be annotated > Semantics: Compiler Plugins > Type Annotations? © Marcus Denker
  • 35. TypePlug > Pluggable types for Squeak > Based on sub-method reflection framework > Case-Studies: — Non-Nil Types — Class Based Types — Confined Types Master Thesis: Nik Haldiman © Marcus Denker
  • 36. The Problem > Large, untyped code-base > Overhead for using pluggable types is high — Existing code needs to be annotated with type information © Marcus Denker
  • 37. Example: Non-Nil Type-System > Declare variables to never be nil Object subclass: #Line typedInstanceVariables: ’startPoint endPoint <:nonNil:>’ typedClassVariables: ’’ poolDictionaries: '' category: 'Demo' © Marcus Denker
  • 38. Non-Nil Type-System moveHorizontally: anInteger startPoint := self movePoint: startPoint horizontally: anInteger. endPoint:=self movePoint: endPoint horizontally: anInteger © Marcus Denker
  • 39. Non-Nil Type-System moveHorizontally: anInteger startPoint := self movePoint: startPoint horizontally: anInteger. endPoint:=self movePoint: endPoint horizontally: anInteger <- type ’TopType’ of expression is not compatible with type ’nonNil’ of variable ’endPoint’. © Marcus Denker
  • 40. Non-Nil Type-System movePoint: aPoint horizontally: anInteger ↑ (aPoint addX: anInteger y: 0) <:nonNil :> © Marcus Denker
  • 41. The Problem (repeat) > Large, untyped code-base > Overhead for using pluggable types is high — Existing code needs to be annotated with type information © Marcus Denker
  • 42. Solution > Only type-check annotated code > Use type-inference to infer types of non-annotated code > Explicit type-casts > Allow external annotations for foreign code © Marcus Denker
  • 43. External Type Annotations > We need to annotate existing code — Especially libraries and frameworks — Example: Object>>#hash is <: nonNil :> > We do not want to change the program code! > Solution: External Type Annotations — Added and modified in the TypesBrowser — Do not change the source — External representation: Type Packages © Marcus Denker
  • 45. Future Work > Improve Type-Inference — Better algorithms — Explore heuristical type inference > Type Checking and Reflection — Use pluggable types to check reflective change © Marcus Denker
  • 46. Conclusion > Pluggable Types — All positive effects of static types — Avoid the problems > TypePlug: Pragmatic framework for Pluggable Types — Example in the context of Smalltalk/Squeak © Marcus Denker
  • 47. Conclusion > Pluggable Types — All positive effects of static types — Avoid the problems > TypePlug: Pragmatic framework for Pluggable Types — Example in the context of Smalltalk/Squeak Questions? © Marcus Denker