SlideShare a Scribd company logo
Transpiling Pharo Classes to JS
ECMAScript 5 versus ECMAScript 6
Noury Bouraqadi & Dave Mason
International Workshop on Smalltalk Technologies Lyon, France; August 29th-31st, 2023
100%
Pharo
Javascript
100%
Development Production
Development Production
2
100%
Pharo
Javascript
100%
Development Production
Development Production
3
ECMAScript
5
100%
Pharo
Javascript
100%
Development Production
Development Production
4
ECMAScript
5
ECMAScript
6?
vs
5
EcmaScript 5
● Prototypes Only
● Dynamic Object Structure
● Whitebox Objects
● Reified Functions
● this Pseudo-variable
● Constructor Functions
● new Operator
ES5
+
Class Related Constructs
● Classes Definition
● Class Inheritance
● Instance Methods
● Class Methods (static)
● super Pseudo-variable
EcmaScript 6
Class Transpilation by Example
6
ES6: Class Definition + Instance Methods
7
ES6: Class Methods
8
JS “Instance Side” Object Graph
9
JS “Instance Side” Object Graph
10
new Counter()
JS “Class Side” Object Graph
11
ES5: Class Definition + Instance Methods
12
ES5: Class Methods
13
Subclass Transpilation by Example
14
15
ES6: Subclass Definition
16
ES6: Subclass Overriding Instance Methods
17
ES6: Subclass Methods
18
JS Subclass “Instance Side” Object Graph
19
JS Subclass “Class Side” Object Graph
20
ES5: Subclass Definition
21
ES5: Subclass Instance Methods
22
ES5: Subclass Methods
23
JS Subclass Access Superclass IV
let c1 = Counter.getDefaultInstance();
let c2 = CircularCounter.getDefaultInstance();
c1 === c2; // true!
24
Property Sharing Fix
Same solution for
both ES5 and ES6
25
JS Subclass Access Superclass IV
let c1 = Counter.getDefaultInstance();
let c2 = CircularCounter.getDefaultInstance();
c1 === c2; // false!
● Mac Book Pro
○ CPU 8 Intel Core i9, 2.3 GHz,
○ RAM 32 GB, 2667 MHz DDR4
○ Hard drive 1 TB SSD, PCI-Express with APFS File System
○ Mac OS X Ventura 13.2.1
● Pharo 10
● Pharo VM 100 Darwin x86 64-bit
● JS Targets
○ Node
○ Web Browser
26
Benchmark Procedure
27
Improved Transpilation Time + File Size
Improvement
~8%
Improvement
1% - 5%
28
Significantly Faster Load Time
Improvement
25% - 33%
● 5 warm up runs
● 10 runs
● Richards: 50 iterations / run
● Delta Blue: 300 iterations / run
29
Run-time Benchmark Procedure
30
Improved Runtime Performance
Improvement
3% - 10%
31
Improved Runtime Performance vs Pharo 10
ES6 vs Pharo10
Improvement
16% - 24%
32
Improved Runtime Performance vs Pharo 10
ES6 vs Pharo10
Improvement
35% - 43%
33
Summary
● PharoJS is a viable solution to reuse JS Ecosystem
● Transition from ES5 to ES6 is Beneficial
○ Significantly faster Load time
○ Improved other benchmarks
○ More idiomatic code with ES6
● JS white box model = no encapsulation
○ Generate accessors on the fly for third party classes
● Inherited Instance Variables e.g CircularCounter example
○ Force IV Creation
● Metaclass inheritance for third party classes
○ class X {...} vs class X extends Object {...}
● Support full Pharo is still a Challenge
○ DoesNotUnderstand
○ superclass - subclasses relationship
○ thisContext, become:, …
34
Getting exact Smalltalk Semantics is Still tricky
Develop in Pharo, Run on JavaScript
PharoJS.org
Kindly Supported by
Thanks to all the contributors!
M
IT
License

More Related Content

PDF
How to upgrade to MongoDB 4.0 - Percona Europe 2018
PDF
Clipper: A Low-Latency Online Prediction Serving System
PPTX
XML London 2013 - Architecture of xproc.xq an XProc processor
PDF
Into The Box 2018 Ortus Keynote
PDF
It's always sunny with OpenJ9
PDF
Rapid Application Development with Cocoon
PDF
WRENCH: Workflow Management System Simulation Workbench
PDF
Testing data and metadata backends with ClawIO
How to upgrade to MongoDB 4.0 - Percona Europe 2018
Clipper: A Low-Latency Online Prediction Serving System
XML London 2013 - Architecture of xproc.xq an XProc processor
Into The Box 2018 Ortus Keynote
It's always sunny with OpenJ9
Rapid Application Development with Cocoon
WRENCH: Workflow Management System Simulation Workbench
Testing data and metadata backends with ClawIO

Similar to Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6 (20)

PDF
PharoJS: Hijack the JavaScript Ecosystem
PDF
Using F# to change the way we work
PPTX
XML Amsterdam 2012 Keynote
PDF
Choosing a MySQL High Availability Solution.pdf
PDF
Upgrading to MongoDB 4.0 from older versions
PPTX
Installing OpenedX on premises. Universitat Politecnica de Valencia experiences
PDF
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
PDF
Start with version control and experiments management in machine learning
PDF
Java 9-10 What's New
PPTX
Docker & ECS: Secure Nearline Execution
PDF
Drools, jBPM OptaPlanner presentation
PPTX
Scalable Whole-Exome Sequence Data Processing Using Workflow On A Cloud
PDF
COBOL to Apache Spark
PPTX
Cold fusion is racecar fast
PDF
Managing data and operation distribution in MongoDB
PPTX
CNCF Thanos @ Qonto
PPTX
Terraform Modules Restructured
PPTX
Terraform modules restructured
PDF
Machine learning and big data @ uber a tale of two systems
PDF
Thesis Defense (Gwendal DANIEL) - Nov 2017
PharoJS: Hijack the JavaScript Ecosystem
Using F# to change the way we work
XML Amsterdam 2012 Keynote
Choosing a MySQL High Availability Solution.pdf
Upgrading to MongoDB 4.0 from older versions
Installing OpenedX on premises. Universitat Politecnica de Valencia experiences
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
Start with version control and experiments management in machine learning
Java 9-10 What's New
Docker & ECS: Secure Nearline Execution
Drools, jBPM OptaPlanner presentation
Scalable Whole-Exome Sequence Data Processing Using Workflow On A Cloud
COBOL to Apache Spark
Cold fusion is racecar fast
Managing data and operation distribution in MongoDB
CNCF Thanos @ Qonto
Terraform Modules Restructured
Terraform modules restructured
Machine learning and big data @ uber a tale of two systems
Thesis Defense (Gwendal DANIEL) - Nov 2017
Ad

More from ESUG (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Directing Generative AI for Pharo Documentation
PDF
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
PDF
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
PDF
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
PDF
Analysing Python Machine Learning Notebooks with Moose
PDF
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
PDF
Package-Aware Approach for Repository-Level Code Completion in Pharo
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
PDF
An Analysis of Inline Method Refactoring
PDF
Identification of unnecessary object allocations using static escape analysis
PDF
Control flow-sensitive optimizations In the Druid Meta-Compiler
PDF
Clean Blocks (IWST 2025, Gdansk, Poland)
PDF
Encoding for Objects Matters (IWST 2025)
PDF
Challenges of Transpiling Smalltalk to JavaScript
PDF
Immersive experiences: what Pharo users do!
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
PDF
Cavrois - an Organic Window Management (ESUG 2025)
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Micromaid: A simple Mermaid-like chart generator for Pharo
Directing Generative AI for Pharo Documentation
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
Analysing Python Machine Learning Notebooks with Moose
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
Package-Aware Approach for Repository-Level Code Completion in Pharo
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
An Analysis of Inline Method Refactoring
Identification of unnecessary object allocations using static escape analysis
Control flow-sensitive optimizations In the Druid Meta-Compiler
Clean Blocks (IWST 2025, Gdansk, Poland)
Encoding for Objects Matters (IWST 2025)
Challenges of Transpiling Smalltalk to JavaScript
Immersive experiences: what Pharo users do!
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
Cavrois - an Organic Window Management (ESUG 2025)
Ad

Recently uploaded (20)

PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
Types of Token_ From Utility to Security.pdf
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
GSA Content Generator Crack (2025 Latest)
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
Trending Python Topics for Data Visualization in 2025
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Time Tracking Features That Teams and Organizations Actually Need
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PPTX
chapter 5 systemdesign2008.pptx for cimputer science students
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
Why Generative AI is the Future of Content, Code & Creativity?
Weekly report ppt - harsh dattuprasad patel.pptx
Designing Intelligence for the Shop Floor.pdf
DNT Brochure 2025 – ISV Solutions @ D365
Types of Token_ From Utility to Security.pdf
Advanced SystemCare Ultimate Crack + Portable (2025)
GSA Content Generator Crack (2025 Latest)
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Trending Python Topics for Data Visualization in 2025
Wondershare Recoverit Full Crack New Version (Latest 2025)
Computer Software and OS of computer science of grade 11.pptx
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Time Tracking Features That Teams and Organizations Actually Need
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Topaz Photo AI Crack New Download (Latest 2025)
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
chapter 5 systemdesign2008.pptx for cimputer science students

Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6