SlideShare a Scribd company logo
First-Class

Undefined Classes

for Pharo
From Alternative Designs to a Unified Practical Solution
Guille Polito, Luc Fabresse, Stéphane Ducasse
@guillepolito
Context
Package
Dependency
Object
Platform
workingDirectory
Windows
workingDirectory
Platform
workingDirectory
Unix
call:library:
FFI
Platform >> workingDirectory
^ self subclassResponsibility
Windows >> workingDirectory
^ FFI call: ’_getcwd’ library: LibC
Unix >> workingDirectory
^ FFI call: ’getcwd’ library: LibC
Problem Overview
Load
Error!
Package
Platform
workingDirectory
Windows
workingDirectory
Platform
workingDirectory
Unix
Problem Statement
• Loading code with unresolved class references
happens when:
• Migrating code to new Pharo versions
• Loading code with unknown or cyclic dependencies
Problem of Tools
Undefined Classes
• First-class entity representing non-existing classes to load:
• subclasses with unknown superclasses
• methods extending unknown classes
• Single and uniform mechanism for all tools
Design 1
Object
Class
UndefinedClass UndefinedClass
class
Windows
Windows class
Unix Unix class
Shared for all non-existent classes (name lost, …)
A unique UndefinedClass class
Design 2
One instance of UndefinedClass per undefined class
Object Class
UndefinedClass
Windows
Windows class
WindowsFFI WindowsFFI class
Platform
FFI
UndefinedClass
class
Class class
Complex and tools issue that must deal with
UndefinedClass instances in addition to Classes and Traits
Design 3
One subclass of UndefinedClass per undefined class
Object
Class
UndefinedClass
UndefinedClass
class
Windows Windows class
WindowsFFI WindowsFFI class
Platform Platform class
FFI FFI class
UndefinedClass will behave as a normal defined class (can
be instantiated? …)
Design selection for Pharo
Ensuring Loading Correctness
• Only one UndefinedClass subclass per missing
class (identity)
• UndefinedClass subclass automatic migration, and
destruction when loading the actual class
• System uniformity i.e., all code loading mechanism
relies on our system
UndefinedClasses MOP
• an UndefinedClass cannot be instantiated
• UndefinedClass>>doesNotUnderstand: throws a
notifying error
• prevent misunderstanding with sub-instances
Tools Integration
• Monticello
• create undefined classes at load time if needed
• create the extended class as UndefinedClasses if
non-existing
• CodeImporter
• parse class definition expressions and create
undefined superclasses if needed
• create the extended class as UndefinedClasses if
non-existing
UndefinedClasses
in action
Migrating Old Code
• Seaside 2.8 (2011)
• subclasses of PackageInfo (removed in Pharo 4)
• extension methods in BlockContext (removed ~Pharo 2)
and ContextPart (renamed Context in Pharo 4)
ConfigurationOfSeaside28 load
• Omni Browser (2015)
• subclasses + extension methods of undefined classes
• class-side initialize with references to undefined classes
ConfigurationOfOmniBrowser project lastVersion load
Loading Order
• Loading Seaside 3 and its 59 monticello packages
dependencies in a random order
Seaside3LoadingTest>> testLoadingSeasidePackagesInRandomOrder
| maxNbOfUndefinedClasses |
self assert: UndefinedClass allSubclasses isEmpty.
maxNbOfUndefinedClasses := self loadSeasidePackagesInRandomOrder.
self assert: maxNbOfUndefinedClasses > 0.
self assert: UndefinedClass allSubclasses isEmpty.
self executeInitializeClassMethodsInCorrectOrder.
self assertAllSeasideUnitTestsAreGreen.
Conclusion
• An UndefinedClass
• is a first-class entity representing one missing class
• stores all information (name, extension methods, …)
• can be subclassed and referenced
• is destroyed when loading actual class definition after
introducing all infos in the real class
• has a specific MOP
• is compliant with tools (MC, CodeImporter)
Future Work
• Integration of Undefined Classes into Pharo 7.0
• Towards a module system:
• when loading a module, class references inside a
module may not be resolved until we bound them
Conclusion
• An UndefinedClass
• is a first-class entity representing one missing class
• stores all information (name, extension methods, …)
• can be subclassed and referenced
• is destroyed when loading actual class definition after
introducing all infos in the real class
• has a specific MOP
• is compliant with tools (MC, CodeImporter)

More Related Content

Similar to First-class undefined classes for Pharo

Towards easy program migration using language virtualization
 Towards easy program migration using language virtualization Towards easy program migration using language virtualization
Towards easy program migration using language virtualization
ESUG
 
Building Container Defence Executable at a Time.pdf
Building Container Defence Executable at a Time.pdfBuilding Container Defence Executable at a Time.pdf
Building Container Defence Executable at a Time.pdf
Suraj Deshmukh
 
VM vs Docker-Based Pipelines
VM vs Docker-Based PipelinesVM vs Docker-Based Pipelines
VM vs Docker-Based Pipelines
Codefresh
 
Organizing Your PHP Projects (2010 ConFoo)
Organizing Your PHP Projects (2010 ConFoo)Organizing Your PHP Projects (2010 ConFoo)
Organizing Your PHP Projects (2010 ConFoo)
Paul Jones
 
3.1.d manual bash script guide lsstv 2.0r11
3.1.d manual bash script guide lsstv 2.0r113.1.d manual bash script guide lsstv 2.0r11
3.1.d manual bash script guide lsstv 2.0r11
Acácio Oliveira
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
Phuc Nguyen
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
Adam Englander
 
To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016
To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016
To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016
Codemotion
 
Building Emmbedded Linux with Yocto project
Building Emmbedded Linux with Yocto projectBuilding Emmbedded Linux with Yocto project
Building Emmbedded Linux with Yocto project
twcoimbatore
 
j-chap1-Basics.ppt
j-chap1-Basics.pptj-chap1-Basics.ppt
j-chap1-Basics.ppt
SmitaBorkar9
 
Pos 433 pos433
Pos 433 pos433Pos 433 pos433
Pos 433 pos433
GOODCourseHelp
 
Advanced Docker Developer Workflows on MacOS X and Windows
Advanced Docker Developer Workflows on MacOS X and WindowsAdvanced Docker Developer Workflows on MacOS X and Windows
Advanced Docker Developer Workflows on MacOS X and Windows
Anil Madhavapeddy
 
OSCON: Advanced Docker developer workflows on Mac OS and Windows
OSCON: Advanced Docker developer workflows on Mac OS and WindowsOSCON: Advanced Docker developer workflows on Mac OS and Windows
OSCON: Advanced Docker developer workflows on Mac OS and Windows
Docker, Inc.
 
Docker Dojo
Docker DojoDocker Dojo
Introduction to XPConnect
Introduction to XPConnectIntroduction to XPConnect
Introduction to XPConnect
Anant Narayanan
 
DSL's with Groovy
DSL's with GroovyDSL's with Groovy
DSL's with Groovy
paulbowler
 
1assembly in c#
1assembly in c#1assembly in c#
1assembly in c#
Sireesh K
 
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
Deepak Chandani
 

Similar to First-class undefined classes for Pharo (20)

Towards easy program migration using language virtualization
 Towards easy program migration using language virtualization Towards easy program migration using language virtualization
Towards easy program migration using language virtualization
 
Building Container Defence Executable at a Time.pdf
Building Container Defence Executable at a Time.pdfBuilding Container Defence Executable at a Time.pdf
Building Container Defence Executable at a Time.pdf
 
VM vs Docker-Based Pipelines
VM vs Docker-Based PipelinesVM vs Docker-Based Pipelines
VM vs Docker-Based Pipelines
 
Organizing Your PHP Projects (2010 ConFoo)
Organizing Your PHP Projects (2010 ConFoo)Organizing Your PHP Projects (2010 ConFoo)
Organizing Your PHP Projects (2010 ConFoo)
 
3.1.d manual bash script guide lsstv 2.0r11
3.1.d manual bash script guide lsstv 2.0r113.1.d manual bash script guide lsstv 2.0r11
3.1.d manual bash script guide lsstv 2.0r11
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016
To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016
To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016
 
Building Emmbedded Linux with Yocto project
Building Emmbedded Linux with Yocto projectBuilding Emmbedded Linux with Yocto project
Building Emmbedded Linux with Yocto project
 
cms.ppt
cms.pptcms.ppt
cms.ppt
 
Composer
ComposerComposer
Composer
 
j-chap1-Basics.ppt
j-chap1-Basics.pptj-chap1-Basics.ppt
j-chap1-Basics.ppt
 
Pos 433 pos433
Pos 433 pos433Pos 433 pos433
Pos 433 pos433
 
Advanced Docker Developer Workflows on MacOS X and Windows
Advanced Docker Developer Workflows on MacOS X and WindowsAdvanced Docker Developer Workflows on MacOS X and Windows
Advanced Docker Developer Workflows on MacOS X and Windows
 
OSCON: Advanced Docker developer workflows on Mac OS and Windows
OSCON: Advanced Docker developer workflows on Mac OS and WindowsOSCON: Advanced Docker developer workflows on Mac OS and Windows
OSCON: Advanced Docker developer workflows on Mac OS and Windows
 
Docker Dojo
Docker DojoDocker Dojo
Docker Dojo
 
Introduction to XPConnect
Introduction to XPConnectIntroduction to XPConnect
Introduction to XPConnect
 
DSL's with Groovy
DSL's with GroovyDSL's with Groovy
DSL's with Groovy
 
1assembly in c#
1assembly in c#1assembly in c#
1assembly in c#
 
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
 

More from Guille Polito

Run-Fail-Grow: Creating Tailored Object Oriented Runtimes
Run-Fail-Grow: Creating Tailored Object Oriented RuntimesRun-Fail-Grow: Creating Tailored Object Oriented Runtimes
Run-Fail-Grow: Creating Tailored Object Oriented Runtimes
Guille Polito
 
PADR - Engineering for Reseach
PADR - Engineering for ReseachPADR - Engineering for Reseach
PADR - Engineering for Reseach
Guille Polito
 
Understanding the Pharo dev Process
Understanding the Pharo dev ProcessUnderstanding the Pharo dev Process
Understanding the Pharo dev Process
Guille Polito
 
Oz Object Spaces - Uqbar Workshop 2013 (spanish)
Oz Object Spaces - Uqbar Workshop 2013 (spanish)Oz Object Spaces - Uqbar Workshop 2013 (spanish)
Oz Object Spaces - Uqbar Workshop 2013 (spanish)
Guille Polito
 
Going Native With DBXTalk - Smalltalks 2013
Going Native With DBXTalk - Smalltalks 2013Going Native With DBXTalk - Smalltalks 2013
Going Native With DBXTalk - Smalltalks 2013
Guille Polito
 
Virtual Smalltalk Images - IWST - ESUG 2013
Virtual Smalltalk Images - IWST - ESUG 2013Virtual Smalltalk Images - IWST - ESUG 2013
Virtual Smalltalk Images - IWST - ESUG 2013
Guille Polito
 
Where am I in my Phd - October 2012
Where am I in my Phd - October 2012Where am I in my Phd - October 2012
Where am I in my Phd - October 2012
Guille Polito
 
Bootstrapping a Smalltalk - Smalltalks 2012
Bootstrapping a Smalltalk - Smalltalks 2012Bootstrapping a Smalltalk - Smalltalks 2012
Bootstrapping a Smalltalk - Smalltalks 2012
Guille Polito
 
DBXTalk - Smalltalks 2011
DBXTalk - Smalltalks 2011DBXTalk - Smalltalks 2011
DBXTalk - Smalltalks 2011
Guille Polito
 

More from Guille Polito (9)

Run-Fail-Grow: Creating Tailored Object Oriented Runtimes
Run-Fail-Grow: Creating Tailored Object Oriented RuntimesRun-Fail-Grow: Creating Tailored Object Oriented Runtimes
Run-Fail-Grow: Creating Tailored Object Oriented Runtimes
 
PADR - Engineering for Reseach
PADR - Engineering for ReseachPADR - Engineering for Reseach
PADR - Engineering for Reseach
 
Understanding the Pharo dev Process
Understanding the Pharo dev ProcessUnderstanding the Pharo dev Process
Understanding the Pharo dev Process
 
Oz Object Spaces - Uqbar Workshop 2013 (spanish)
Oz Object Spaces - Uqbar Workshop 2013 (spanish)Oz Object Spaces - Uqbar Workshop 2013 (spanish)
Oz Object Spaces - Uqbar Workshop 2013 (spanish)
 
Going Native With DBXTalk - Smalltalks 2013
Going Native With DBXTalk - Smalltalks 2013Going Native With DBXTalk - Smalltalks 2013
Going Native With DBXTalk - Smalltalks 2013
 
Virtual Smalltalk Images - IWST - ESUG 2013
Virtual Smalltalk Images - IWST - ESUG 2013Virtual Smalltalk Images - IWST - ESUG 2013
Virtual Smalltalk Images - IWST - ESUG 2013
 
Where am I in my Phd - October 2012
Where am I in my Phd - October 2012Where am I in my Phd - October 2012
Where am I in my Phd - October 2012
 
Bootstrapping a Smalltalk - Smalltalks 2012
Bootstrapping a Smalltalk - Smalltalks 2012Bootstrapping a Smalltalk - Smalltalks 2012
Bootstrapping a Smalltalk - Smalltalks 2012
 
DBXTalk - Smalltalks 2011
DBXTalk - Smalltalks 2011DBXTalk - Smalltalks 2011
DBXTalk - Smalltalks 2011
 

Recently uploaded

Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 

Recently uploaded (20)

Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 

First-class undefined classes for Pharo

  • 1. First-Class
 Undefined Classes
 for Pharo From Alternative Designs to a Unified Practical Solution Guille Polito, Luc Fabresse, Stéphane Ducasse @guillepolito
  • 2. Context Package Dependency Object Platform workingDirectory Windows workingDirectory Platform workingDirectory Unix call:library: FFI Platform >> workingDirectory ^ self subclassResponsibility Windows >> workingDirectory ^ FFI call: ’_getcwd’ library: LibC Unix >> workingDirectory ^ FFI call: ’getcwd’ library: LibC
  • 4. Problem Statement • Loading code with unresolved class references happens when: • Migrating code to new Pharo versions • Loading code with unknown or cyclic dependencies
  • 6. Undefined Classes • First-class entity representing non-existing classes to load: • subclasses with unknown superclasses • methods extending unknown classes • Single and uniform mechanism for all tools
  • 7. Design 1 Object Class UndefinedClass UndefinedClass class Windows Windows class Unix Unix class Shared for all non-existent classes (name lost, …) A unique UndefinedClass class
  • 8. Design 2 One instance of UndefinedClass per undefined class Object Class UndefinedClass Windows Windows class WindowsFFI WindowsFFI class Platform FFI UndefinedClass class Class class Complex and tools issue that must deal with UndefinedClass instances in addition to Classes and Traits
  • 9. Design 3 One subclass of UndefinedClass per undefined class Object Class UndefinedClass UndefinedClass class Windows Windows class WindowsFFI WindowsFFI class Platform Platform class FFI FFI class UndefinedClass will behave as a normal defined class (can be instantiated? …)
  • 11. Ensuring Loading Correctness • Only one UndefinedClass subclass per missing class (identity) • UndefinedClass subclass automatic migration, and destruction when loading the actual class • System uniformity i.e., all code loading mechanism relies on our system
  • 12. UndefinedClasses MOP • an UndefinedClass cannot be instantiated • UndefinedClass>>doesNotUnderstand: throws a notifying error • prevent misunderstanding with sub-instances
  • 13. Tools Integration • Monticello • create undefined classes at load time if needed • create the extended class as UndefinedClasses if non-existing • CodeImporter • parse class definition expressions and create undefined superclasses if needed • create the extended class as UndefinedClasses if non-existing
  • 15. Migrating Old Code • Seaside 2.8 (2011) • subclasses of PackageInfo (removed in Pharo 4) • extension methods in BlockContext (removed ~Pharo 2) and ContextPart (renamed Context in Pharo 4) ConfigurationOfSeaside28 load • Omni Browser (2015) • subclasses + extension methods of undefined classes • class-side initialize with references to undefined classes ConfigurationOfOmniBrowser project lastVersion load
  • 16. Loading Order • Loading Seaside 3 and its 59 monticello packages dependencies in a random order Seaside3LoadingTest>> testLoadingSeasidePackagesInRandomOrder | maxNbOfUndefinedClasses | self assert: UndefinedClass allSubclasses isEmpty. maxNbOfUndefinedClasses := self loadSeasidePackagesInRandomOrder. self assert: maxNbOfUndefinedClasses > 0. self assert: UndefinedClass allSubclasses isEmpty. self executeInitializeClassMethodsInCorrectOrder. self assertAllSeasideUnitTestsAreGreen.
  • 17. Conclusion • An UndefinedClass • is a first-class entity representing one missing class • stores all information (name, extension methods, …) • can be subclassed and referenced • is destroyed when loading actual class definition after introducing all infos in the real class • has a specific MOP • is compliant with tools (MC, CodeImporter)
  • 18. Future Work • Integration of Undefined Classes into Pharo 7.0 • Towards a module system: • when loading a module, class references inside a module may not be resolved until we bound them
  • 19. Conclusion • An UndefinedClass • is a first-class entity representing one missing class • stores all information (name, extension methods, …) • can be subclassed and referenced • is destroyed when loading actual class definition after introducing all infos in the real class • has a specific MOP • is compliant with tools (MC, CodeImporter)