SlideShare a Scribd company logo
1 of 36
TclOO
Past,Present,Future…
Donal K. Fellows
University of Manchester / Tcl Core Team
Or “What I’ve Been Doing for the Past
Few Years Instead of Watching Bad TV”…
TcLOO: Past
Where it came from, how it was
developed
What is TclOO?
• New Standard Object System
• Part of Tcl 8.6
– Available as extension for Tcl 8.5
oo::classcreateToaster {
variableuseCount
constructor {} { setuseCount 0 }
methodmakeToast {{slices 1}} {
incruseCount
for {seti 0} {$i<$slices} {incri} {
puts"made slice $i from use $useCount"
}
}
}
set t [Toaster new]
$tmakeToast; #  made slice 1 from use 1
10/02/09 3Tcl Conference 2009, Portland Oregon
Why?
• Existing Object Systems had Issues
– Some were too slow
– Some were messy internally
– Some were entangled with class libraries
– All were poorly integrated with Tcl
• Except Tk, which is plain inflexible
• TclOO Exists to be a Small Object System
– But deeply integrated with Tcl
– Allow other OO systems to be built
on top
10/02/09 4Tcl Conference 2009, Portland Oregon
Where Did TclOO Come
From?
• Many Principal Lineages
– Tk
• General style of method calling
– [incr Tcl]
• Way of declaring classes, much syntax
– XOTcl
• Semantics of class system
– Snit
• Support delegation and scriptability
10/02/09 5Tcl Conference 2009, Portland Oregon
Who and When?
• First Glimmerings at Tcl 2003
– Will Duquette and myself
• Also lead to 8.5’s ensembles
• Nearly 2 Years Later (2005)
– Steve Landers, Will and myself wrote spec
• Prompted by Mike Doyle and Jeff Hobbs
• First prototype by me in 2006
– Started getting much useful TCT input
• Full prototype in 2007
• Committed to Tcl in 2008
– Few small things added since with usage
experience
• Overall Gestation was 3-5 Years!
10/02/09 6Tcl Conference 2009, Portland Oregon
Development
• Scripted Prototype
– Very difficult, so scrapped in favour of…
• CVS Feature Branch of Tcl
– Written in C
– Planned for deep integration
– No unrelated changes
10/02/09 7Tcl Conference 2009, Portland Oregon
Key Milestones
1. Initial Specification
2. Working Method Invocation
3. Definition Command
4. Starting the Test Suite
5. Generic Method C API
6. Converting to a Package
7. Doing a Release
10/02/09 8Tcl Conference 2009, Portland Oregon
Lessons Learned…
• Make a Plan
– Define what success is!
• Study the Competition
– Steal their good ideas!
• Be Clean in Development
– No releases until people will be able to run it
– Don’t mix in irrelevant features
• Testing is Vital
10/02/09 9Tcl Conference 2009, Portland Oregon
TclOO: Present
Features, Use and Performance
What does TclOO Offer?
• Powerful Object System
• Small Feature Set
• Stability
• Deep Integration with Tcl
• Can be Driven from C API
• Fast Core
10/02/09 11Tcl Conference 2009, Portland Oregon
The Example Again
oo::classcreateToaster {
variableuseCount
constructor {} {
setuseCount 0
}
methodmakeToast {{slices 1}} {
incruseCount
for {seti 0} {$i< $slices} {incri} {
puts"made slice $i from use $useCount”
}
}
}
set toastie [Toaster new]
$toastiemakeToast; #  made slice 1 from use 1
10/02/09 12Tcl Conference 2009, Portland Oregon
Making our Toaster Fly
with a Mixin
oo::classcreateFlyingObject {
methodtakeOff! {} { … }
methodland {} { … }
methodgetAltitude {} { … }
}
oo::objdefine $toastiemixinFlyingObject
$toastietakeOff!
$toastiemakeToast
10/02/09 13Tcl Conference 2009, Portland Oregon
TclOO Power
• Same Basic Semantic Model as XOTcl
• Single Rooted Multiple Inheritance
– Subclassable Class Objects in Object System
• Mixins (“ad hoc” classes) and Filters
– Enables things like Prototypes and Aspects
• Two Types of Methods
– Procedure-like
– Forwarded/Delegated
10/02/09 14Tcl Conference 2009, Portland Oregon
TclOO Features
• As Few as Possible
– Scriptable and Composable
• Every Object has its own Namespace
– Holds all variables
• Objects can be Renamed
• Objects can be Reclassed
• Definitions by Scripts
– Somewhat similar to [incr Tcl] and Snit definitions
• Introspection Integrated into [info]
10/02/09 15Tcl Conference 2009, Portland Oregon
Scripting: Class Variables
proc::oo::Helpers::classvar {nameargs} {
# Get reference to class’s namespace
setns [infoobjectnamespace[uplevel 1 {selfclass}]]
# Double up the list of variable names
setvs [list $name $name]
foreachv $args {lappendvs $v $v}
# Link the caller’s locals to the class’s variables
tailcallnamespaceupvar $ns {*}$vs
}
10/02/09 Tcl Conference 2009, Portland Oregon 16
Scripting: Class Methods
proc::oo::define::classmethod {name {args ""} {body ""}} {
# Create the method on the class ifthe caller gave
# arguments and body
if {[llength [infolevel 0]] == 4} {
uplevel1 [listselfmethod $name $args $body]
}
# Get the name of the class being defined
setcls [lindex [infolevel -1] 1]
# Make connection to private class “my” command by
# forwarding
tailcallforward $name [infoobjectnamespace $cls]::my$name
}
10/02/09 Tcl Conference 2009, Portland Oregon 17
Stability and Testing
• Test Suite Covers Normal and Error Cases
– Includes checks for various clean teardowns
– Includes checks for leaking memory
• Goal: As Stable and Robust as Tcl
– Should be no unchecked failures ever
10/02/09 18Tcl Conference 2009, Portland Oregon
Production Use of TclOO
• Powers TDBC
– Also show that TclOO supports UML Composition
• Supports itcl-ng
– This is [incr Tcl] in Tcl as contrib. package
– Uses TclOO to provide basic OO framework
• Commercial Uses
– Example: AnsaldoSTS use it in their railway
maintenance support product
10/02/09 19Tcl Conference 2009, Portland Oregon
Tricks in TDBC: Lifetime
• TDBC uses Cunning Lifetime
Management Techniques
– UML Class Composition
• Based on Ownership
– Each Statement owned by
one Connection
– Each ResultSet owned by one
Statement
• Implemented by Placing
Owned into Owner’s
Namespace
– Automatic deletion when
owner goes away
Connection
Statement Statement
ResultSet ResultSet ResultSet
Statement
10/02/09 Tcl Conference 2009, Portland Oregon 20
Tcl Integration
• Available as Package for 8.5
– Thanks to ActiveState for build support
• Part of Tcl 8.6
– Fully supports NRE
• Doesn’t blow C stack
• Can [yield] inside method calls and constructors
• Connection to Tcl Procedure Engine
– Other OO extensions that use TclOO to implement
methods are no longer tightly coupled to Tcl
10/02/09 21Tcl Conference 2009, Portland Oregon
The TclOO C API
• TclOO uses its own C API
– Generic Method Definition Interface
• All standard methods built on top of that
– Construction API
• No destruction API; use existing facilities
– Introspection API
• Information about objects
• Information about current method
• The C API is a Vital Part of TclOO
10/02/09 22Tcl Conference 2009, Portland Oregon
TclOO Performance
• TclOO is Fast
– Fastest Object System for Tcl
• Massive Amount of Caching
– Especially of method interpretations
• In object, class and Tcl_Obj internal representation
– Caches flushed conservatively
• Critical Paths Analysed to Reduce Hot Allocs
– Object creation
– Method call
10/02/09 23Tcl Conference 2009, Portland Oregon
Performance: Basic Call
0
200000
400000
600000
800000
1000000
1200000
1400000
1600000
1800000
Tcl 8.5.2 Tcl 8.6b1.1
Callspersecond
Procedure
TclOO
XOTcl
[incr Tcl]
Snit
Stooop
10/02/09 24Tcl Conference 2009, Portland Oregon
Performance: Stateful Call
0
200000
400000
600000
800000
1000000
1200000
Tcl 8.5.2 Tcl 8.6b1.1
Callspersecond
Procedure
TclOO
XOTcl
[incr Tcl]
Snit
Stooop
10/02/09 25Tcl Conference 2009, Portland Oregon
Performance: Create/Delete
0
20000
40000
60000
80000
100000
120000
140000
160000
180000
200000
Tcl 8.5.2 Tcl8.6b1.1
Callspersecond
TclOO
XOTcl
[incr Tcl]
Snit
Stooop
10/02/09 26Tcl Conference 2009, Portland Oregon
Performance:
Make/Call 10/Del.
0
10000
20000
30000
40000
50000
60000
70000
Tcl 8.5.2 Tcl 8.6b1.1
Callspersecond
TclOO
XOTcl
[incr Tcl]
Snit
Stooop
10/02/09 27Tcl Conference 2009, Portland Oregon
Performance:
Superclass Call
0
100000
200000
300000
400000
500000
600000
700000
Tcl 8.5.2 Tcl 8.6b1.1
Callspersecond
TclOO
XOTcl
[incr Tcl]
Stooop
10/02/09 28Tcl Conference 2009, Portland Oregon
TclOO: Future
Possible future directions
New TclOO Features?
• Garbage Collection
– Only of unrenamed objects from “new” method
– Problematic because it doesn‟t fit Tcl‟s semantics
• Unlikely to break scripts that weren‟t leaking
• Submethods
– More like Tk/Snit
– Very nice to use, but some tricky issues
• How does inheritance work?
– Portable scripts will make method names be
single words
10/02/09 30Tcl Conference 2009, Portland Oregon
Jazzing Up TclOO’s Internals
• Slots
– Better way to manage configuration
• Likely to cause issues with anything named
starting with a “-” character
– But slots are objects
– Should methods and variables be objects?
• Needs investigation
• Poking in the Guts
– e.g., ways to change how methods are looked
up
• Currently some hacks for itcl-ng; want better…
10/02/09 31Tcl Conference 2009, Portland Oregon
Building a Class Library
• Already prototyped on Wiki
– Serialization
– Channel engine
– Megawidgets
• How to distribute between packages?
– Which in Tcl?
– Which in Tk?
– Which in Tcllib?
10/02/09 32Tcl Conference 2009, Portland Oregon
Object Serialization
• Write Objects to a String and
Read Back
– Can also go over sockets or through
files or …
• Experimental Package on Wiki
– http://wiki.tcl.tk/23444
– Does not serialize classes
– Does not deal with object name
clashes
– Needs cooperation from objects to
explore object graph
Interp.
#1
Socket
Interp.
#2
10/02/09 33Tcl Conference 2009, Portland Oregon
Channel Engine Classes
• Classes to Make Writing Channels Easy
– Based on Andreas Kupries‟s channel API
– Both full channels and transformations
• Prototype Code on Wiki
– http://wiki.tcl.tk/21723
– Introspection to find what features to support
10/02/09 34Tcl Conference 2009, Portland Oregon
Megawidgets
• Make Tk Widgets with TclOO Objects
– Work in “the same” way
– Wrap actual widgets
• Prototype Code on Wiki
– http://wiki.tcl.tk/21103
• Already Driven Two Features Added
– The „variable‟ declaration
– Improved method forwarding to object-local
commands
10/02/09 35Tcl Conference 2009, Portland Oregon
Where Next?
• TclOO Intended to be Foundation
– Fast, light, small, stable, and above all Tcl-ish
– It deals with the really complicated bits so you
don‟t have to
• Features to Add Should be Community-
Driven
– If you want it, let us know!
10/02/09 36Tcl Conference 2009, Portland Oregon

More Related Content

What's hot

Clojure Intro
Clojure IntroClojure Intro
Clojure Introthnetos
 
Generics Past, Present and Future (Latest)
Generics Past, Present and Future (Latest)Generics Past, Present and Future (Latest)
Generics Past, Present and Future (Latest)RichardWarburton
 
The Sincerest Form of Flattery
The Sincerest Form of FlatteryThe Sincerest Form of Flattery
The Sincerest Form of FlatteryJosé Paumard
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongMario Fusco
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - StockholmJan Kronquist
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)Pavlo Baron
 
SQL Server Select Topics
SQL Server Select TopicsSQL Server Select Topics
SQL Server Select TopicsJay Coskey
 
03 Java Language And OOP Part III
03 Java Language And OOP Part III03 Java Language And OOP Part III
03 Java Language And OOP Part IIIHari Christian
 
Class graph neo4j and software metrics
Class graph neo4j and software metricsClass graph neo4j and software metrics
Class graph neo4j and software metricsjexp
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedSusan Potter
 
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24  tricky stuff in java grammar and javacJug trojmiasto 2014.04.24  tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javacAnna Brzezińska
 
Generics Past, Present and Future
Generics Past, Present and FutureGenerics Past, Present and Future
Generics Past, Present and FutureRichardWarburton
 
Odessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and PythonOdessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and PythonMax Klymyshyn
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with GroovyArturo Herrero
 
DevNation'15 - Using Lambda Expressions to Query a Datastore
DevNation'15 - Using Lambda Expressions to Query a DatastoreDevNation'15 - Using Lambda Expressions to Query a Datastore
DevNation'15 - Using Lambda Expressions to Query a DatastoreXavier Coulon
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersBartosz Kosarzycki
 
Nice to meet Kotlin
Nice to meet KotlinNice to meet Kotlin
Nice to meet KotlinJieyi Wu
 
Java collections the force awakens
Java collections  the force awakensJava collections  the force awakens
Java collections the force awakensRichardWarburton
 

What's hot (20)

Clojure Intro
Clojure IntroClojure Intro
Clojure Intro
 
Generics Past, Present and Future (Latest)
Generics Past, Present and Future (Latest)Generics Past, Present and Future (Latest)
Generics Past, Present and Future (Latest)
 
Collections forceawakens
Collections forceawakensCollections forceawakens
Collections forceawakens
 
The Sincerest Form of Flattery
The Sincerest Form of FlatteryThe Sincerest Form of Flattery
The Sincerest Form of Flattery
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are Wrong
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - Stockholm
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
SQL Server Select Topics
SQL Server Select TopicsSQL Server Select Topics
SQL Server Select Topics
 
03 Java Language And OOP Part III
03 Java Language And OOP Part III03 Java Language And OOP Part III
03 Java Language And OOP Part III
 
Java Programming - 06 java file io
Java Programming - 06 java file ioJava Programming - 06 java file io
Java Programming - 06 java file io
 
Class graph neo4j and software metrics
Class graph neo4j and software metricsClass graph neo4j and software metrics
Class graph neo4j and software metrics
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids Applied
 
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24  tricky stuff in java grammar and javacJug trojmiasto 2014.04.24  tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
 
Generics Past, Present and Future
Generics Past, Present and FutureGenerics Past, Present and Future
Generics Past, Present and Future
 
Odessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and PythonOdessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and Python
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
 
DevNation'15 - Using Lambda Expressions to Query a Datastore
DevNation'15 - Using Lambda Expressions to Query a DatastoreDevNation'15 - Using Lambda Expressions to Query a Datastore
DevNation'15 - Using Lambda Expressions to Query a Datastore
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
 
Nice to meet Kotlin
Nice to meet KotlinNice to meet Kotlin
Nice to meet Kotlin
 
Java collections the force awakens
Java collections  the force awakensJava collections  the force awakens
Java collections the force awakens
 

Similar to TclOO: Past Present Future

Introduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKennaIntroduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKennaopenseesdays
 
How do you eat a whale velocity 2017
How do you eat a whale   velocity 2017How do you eat a whale   velocity 2017
How do you eat a whale velocity 2017Kelly Looney
 
How do you eat a whale? cloud expo 2017
How do you eat a whale?   cloud expo 2017How do you eat a whale?   cloud expo 2017
How do you eat a whale? cloud expo 2017Kelly Looney
 
Pal gov.tutorial3.session3.xpath & xquery (lab1)
Pal gov.tutorial3.session3.xpath & xquery (lab1)Pal gov.tutorial3.session3.xpath & xquery (lab1)
Pal gov.tutorial3.session3.xpath & xquery (lab1)Mustafa Jarrar
 
The ActiveState of Tcl
The ActiveState of TclThe ActiveState of Tcl
The ActiveState of TclActiveState
 
Tcl Status Update, July 2014
Tcl Status Update, July 2014Tcl Status Update, July 2014
Tcl Status Update, July 2014Donal Fellows
 
Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.Bert Brouns
 
OracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive MetastoreOracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive MetastoreDataWorks Summit
 
S. Bartoli & F. Pompermaier – A Semantic Big Data Companion
S. Bartoli & F. Pompermaier – A Semantic Big Data CompanionS. Bartoli & F. Pompermaier – A Semantic Big Data Companion
S. Bartoli & F. Pompermaier – A Semantic Big Data CompanionFlink Forward
 
From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015Randy Shoup
 
OSLC KM (Knowledge Management): elevating the meaning of data and operations ...
OSLC KM (Knowledge Management): elevating the meaning of data and operations ...OSLC KM (Knowledge Management): elevating the meaning of data and operations ...
OSLC KM (Knowledge Management): elevating the meaning of data and operations ...CARLOS III UNIVERSITY OF MADRID
 
Keepit Course 3: Provenance (and OPM), based on slides by Luc Moreau
Keepit Course 3: Provenance (and OPM), based on slides by Luc MoreauKeepit Course 3: Provenance (and OPM), based on slides by Luc Moreau
Keepit Course 3: Provenance (and OPM), based on slides by Luc MoreauJISC KeepIt project
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application DevelopmentDhaval Kaneria
 

Similar to TclOO: Past Present Future (20)

Introduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKennaIntroduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKenna
 
How do you eat a whale velocity 2017
How do you eat a whale   velocity 2017How do you eat a whale   velocity 2017
How do you eat a whale velocity 2017
 
How do you eat a whale? cloud expo 2017
How do you eat a whale?   cloud expo 2017How do you eat a whale?   cloud expo 2017
How do you eat a whale? cloud expo 2017
 
lecture1.ppt
lecture1.pptlecture1.ppt
lecture1.ppt
 
The CoFX Data Model
The CoFX Data ModelThe CoFX Data Model
The CoFX Data Model
 
Pal gov.tutorial3.session3.xpath & xquery (lab1)
Pal gov.tutorial3.session3.xpath & xquery (lab1)Pal gov.tutorial3.session3.xpath & xquery (lab1)
Pal gov.tutorial3.session3.xpath & xquery (lab1)
 
The ActiveState of Tcl
The ActiveState of TclThe ActiveState of Tcl
The ActiveState of Tcl
 
Norman and McCraken, "OpenURL Implementation: Link Resolution That Users Will...
Norman and McCraken, "OpenURL Implementation: Link Resolution That Users Will...Norman and McCraken, "OpenURL Implementation: Link Resolution That Users Will...
Norman and McCraken, "OpenURL Implementation: Link Resolution That Users Will...
 
Tcl Status Update, July 2014
Tcl Status Update, July 2014Tcl Status Update, July 2014
Tcl Status Update, July 2014
 
Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.
 
Stackato v4
Stackato v4Stackato v4
Stackato v4
 
OracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive MetastoreOracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive Metastore
 
Introduction to Kotlin - Android KTX
Introduction to Kotlin - Android KTXIntroduction to Kotlin - Android KTX
Introduction to Kotlin - Android KTX
 
gcdtmp
gcdtmpgcdtmp
gcdtmp
 
S. Bartoli & F. Pompermaier – A Semantic Big Data Companion
S. Bartoli & F. Pompermaier – A Semantic Big Data CompanionS. Bartoli & F. Pompermaier – A Semantic Big Data Companion
S. Bartoli & F. Pompermaier – A Semantic Big Data Companion
 
From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015
 
Clean sw 3_architecture
Clean sw 3_architectureClean sw 3_architecture
Clean sw 3_architecture
 
OSLC KM (Knowledge Management): elevating the meaning of data and operations ...
OSLC KM (Knowledge Management): elevating the meaning of data and operations ...OSLC KM (Knowledge Management): elevating the meaning of data and operations ...
OSLC KM (Knowledge Management): elevating the meaning of data and operations ...
 
Keepit Course 3: Provenance (and OPM), based on slides by Luc Moreau
Keepit Course 3: Provenance (and OPM), based on slides by Luc MoreauKeepit Course 3: Provenance (and OPM), based on slides by Luc Moreau
Keepit Course 3: Provenance (and OPM), based on slides by Luc Moreau
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application Development
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

TclOO: Past Present Future

  • 1. TclOO Past,Present,Future… Donal K. Fellows University of Manchester / Tcl Core Team Or “What I’ve Been Doing for the Past Few Years Instead of Watching Bad TV”…
  • 2. TcLOO: Past Where it came from, how it was developed
  • 3. What is TclOO? • New Standard Object System • Part of Tcl 8.6 – Available as extension for Tcl 8.5 oo::classcreateToaster { variableuseCount constructor {} { setuseCount 0 } methodmakeToast {{slices 1}} { incruseCount for {seti 0} {$i<$slices} {incri} { puts"made slice $i from use $useCount" } } } set t [Toaster new] $tmakeToast; #  made slice 1 from use 1 10/02/09 3Tcl Conference 2009, Portland Oregon
  • 4. Why? • Existing Object Systems had Issues – Some were too slow – Some were messy internally – Some were entangled with class libraries – All were poorly integrated with Tcl • Except Tk, which is plain inflexible • TclOO Exists to be a Small Object System – But deeply integrated with Tcl – Allow other OO systems to be built on top 10/02/09 4Tcl Conference 2009, Portland Oregon
  • 5. Where Did TclOO Come From? • Many Principal Lineages – Tk • General style of method calling – [incr Tcl] • Way of declaring classes, much syntax – XOTcl • Semantics of class system – Snit • Support delegation and scriptability 10/02/09 5Tcl Conference 2009, Portland Oregon
  • 6. Who and When? • First Glimmerings at Tcl 2003 – Will Duquette and myself • Also lead to 8.5’s ensembles • Nearly 2 Years Later (2005) – Steve Landers, Will and myself wrote spec • Prompted by Mike Doyle and Jeff Hobbs • First prototype by me in 2006 – Started getting much useful TCT input • Full prototype in 2007 • Committed to Tcl in 2008 – Few small things added since with usage experience • Overall Gestation was 3-5 Years! 10/02/09 6Tcl Conference 2009, Portland Oregon
  • 7. Development • Scripted Prototype – Very difficult, so scrapped in favour of… • CVS Feature Branch of Tcl – Written in C – Planned for deep integration – No unrelated changes 10/02/09 7Tcl Conference 2009, Portland Oregon
  • 8. Key Milestones 1. Initial Specification 2. Working Method Invocation 3. Definition Command 4. Starting the Test Suite 5. Generic Method C API 6. Converting to a Package 7. Doing a Release 10/02/09 8Tcl Conference 2009, Portland Oregon
  • 9. Lessons Learned… • Make a Plan – Define what success is! • Study the Competition – Steal their good ideas! • Be Clean in Development – No releases until people will be able to run it – Don’t mix in irrelevant features • Testing is Vital 10/02/09 9Tcl Conference 2009, Portland Oregon
  • 10. TclOO: Present Features, Use and Performance
  • 11. What does TclOO Offer? • Powerful Object System • Small Feature Set • Stability • Deep Integration with Tcl • Can be Driven from C API • Fast Core 10/02/09 11Tcl Conference 2009, Portland Oregon
  • 12. The Example Again oo::classcreateToaster { variableuseCount constructor {} { setuseCount 0 } methodmakeToast {{slices 1}} { incruseCount for {seti 0} {$i< $slices} {incri} { puts"made slice $i from use $useCount” } } } set toastie [Toaster new] $toastiemakeToast; #  made slice 1 from use 1 10/02/09 12Tcl Conference 2009, Portland Oregon
  • 13. Making our Toaster Fly with a Mixin oo::classcreateFlyingObject { methodtakeOff! {} { … } methodland {} { … } methodgetAltitude {} { … } } oo::objdefine $toastiemixinFlyingObject $toastietakeOff! $toastiemakeToast 10/02/09 13Tcl Conference 2009, Portland Oregon
  • 14. TclOO Power • Same Basic Semantic Model as XOTcl • Single Rooted Multiple Inheritance – Subclassable Class Objects in Object System • Mixins (“ad hoc” classes) and Filters – Enables things like Prototypes and Aspects • Two Types of Methods – Procedure-like – Forwarded/Delegated 10/02/09 14Tcl Conference 2009, Portland Oregon
  • 15. TclOO Features • As Few as Possible – Scriptable and Composable • Every Object has its own Namespace – Holds all variables • Objects can be Renamed • Objects can be Reclassed • Definitions by Scripts – Somewhat similar to [incr Tcl] and Snit definitions • Introspection Integrated into [info] 10/02/09 15Tcl Conference 2009, Portland Oregon
  • 16. Scripting: Class Variables proc::oo::Helpers::classvar {nameargs} { # Get reference to class’s namespace setns [infoobjectnamespace[uplevel 1 {selfclass}]] # Double up the list of variable names setvs [list $name $name] foreachv $args {lappendvs $v $v} # Link the caller’s locals to the class’s variables tailcallnamespaceupvar $ns {*}$vs } 10/02/09 Tcl Conference 2009, Portland Oregon 16
  • 17. Scripting: Class Methods proc::oo::define::classmethod {name {args ""} {body ""}} { # Create the method on the class ifthe caller gave # arguments and body if {[llength [infolevel 0]] == 4} { uplevel1 [listselfmethod $name $args $body] } # Get the name of the class being defined setcls [lindex [infolevel -1] 1] # Make connection to private class “my” command by # forwarding tailcallforward $name [infoobjectnamespace $cls]::my$name } 10/02/09 Tcl Conference 2009, Portland Oregon 17
  • 18. Stability and Testing • Test Suite Covers Normal and Error Cases – Includes checks for various clean teardowns – Includes checks for leaking memory • Goal: As Stable and Robust as Tcl – Should be no unchecked failures ever 10/02/09 18Tcl Conference 2009, Portland Oregon
  • 19. Production Use of TclOO • Powers TDBC – Also show that TclOO supports UML Composition • Supports itcl-ng – This is [incr Tcl] in Tcl as contrib. package – Uses TclOO to provide basic OO framework • Commercial Uses – Example: AnsaldoSTS use it in their railway maintenance support product 10/02/09 19Tcl Conference 2009, Portland Oregon
  • 20. Tricks in TDBC: Lifetime • TDBC uses Cunning Lifetime Management Techniques – UML Class Composition • Based on Ownership – Each Statement owned by one Connection – Each ResultSet owned by one Statement • Implemented by Placing Owned into Owner’s Namespace – Automatic deletion when owner goes away Connection Statement Statement ResultSet ResultSet ResultSet Statement 10/02/09 Tcl Conference 2009, Portland Oregon 20
  • 21. Tcl Integration • Available as Package for 8.5 – Thanks to ActiveState for build support • Part of Tcl 8.6 – Fully supports NRE • Doesn’t blow C stack • Can [yield] inside method calls and constructors • Connection to Tcl Procedure Engine – Other OO extensions that use TclOO to implement methods are no longer tightly coupled to Tcl 10/02/09 21Tcl Conference 2009, Portland Oregon
  • 22. The TclOO C API • TclOO uses its own C API – Generic Method Definition Interface • All standard methods built on top of that – Construction API • No destruction API; use existing facilities – Introspection API • Information about objects • Information about current method • The C API is a Vital Part of TclOO 10/02/09 22Tcl Conference 2009, Portland Oregon
  • 23. TclOO Performance • TclOO is Fast – Fastest Object System for Tcl • Massive Amount of Caching – Especially of method interpretations • In object, class and Tcl_Obj internal representation – Caches flushed conservatively • Critical Paths Analysed to Reduce Hot Allocs – Object creation – Method call 10/02/09 23Tcl Conference 2009, Portland Oregon
  • 24. Performance: Basic Call 0 200000 400000 600000 800000 1000000 1200000 1400000 1600000 1800000 Tcl 8.5.2 Tcl 8.6b1.1 Callspersecond Procedure TclOO XOTcl [incr Tcl] Snit Stooop 10/02/09 24Tcl Conference 2009, Portland Oregon
  • 25. Performance: Stateful Call 0 200000 400000 600000 800000 1000000 1200000 Tcl 8.5.2 Tcl 8.6b1.1 Callspersecond Procedure TclOO XOTcl [incr Tcl] Snit Stooop 10/02/09 25Tcl Conference 2009, Portland Oregon
  • 26. Performance: Create/Delete 0 20000 40000 60000 80000 100000 120000 140000 160000 180000 200000 Tcl 8.5.2 Tcl8.6b1.1 Callspersecond TclOO XOTcl [incr Tcl] Snit Stooop 10/02/09 26Tcl Conference 2009, Portland Oregon
  • 27. Performance: Make/Call 10/Del. 0 10000 20000 30000 40000 50000 60000 70000 Tcl 8.5.2 Tcl 8.6b1.1 Callspersecond TclOO XOTcl [incr Tcl] Snit Stooop 10/02/09 27Tcl Conference 2009, Portland Oregon
  • 28. Performance: Superclass Call 0 100000 200000 300000 400000 500000 600000 700000 Tcl 8.5.2 Tcl 8.6b1.1 Callspersecond TclOO XOTcl [incr Tcl] Stooop 10/02/09 28Tcl Conference 2009, Portland Oregon
  • 30. New TclOO Features? • Garbage Collection – Only of unrenamed objects from “new” method – Problematic because it doesn‟t fit Tcl‟s semantics • Unlikely to break scripts that weren‟t leaking • Submethods – More like Tk/Snit – Very nice to use, but some tricky issues • How does inheritance work? – Portable scripts will make method names be single words 10/02/09 30Tcl Conference 2009, Portland Oregon
  • 31. Jazzing Up TclOO’s Internals • Slots – Better way to manage configuration • Likely to cause issues with anything named starting with a “-” character – But slots are objects – Should methods and variables be objects? • Needs investigation • Poking in the Guts – e.g., ways to change how methods are looked up • Currently some hacks for itcl-ng; want better… 10/02/09 31Tcl Conference 2009, Portland Oregon
  • 32. Building a Class Library • Already prototyped on Wiki – Serialization – Channel engine – Megawidgets • How to distribute between packages? – Which in Tcl? – Which in Tk? – Which in Tcllib? 10/02/09 32Tcl Conference 2009, Portland Oregon
  • 33. Object Serialization • Write Objects to a String and Read Back – Can also go over sockets or through files or … • Experimental Package on Wiki – http://wiki.tcl.tk/23444 – Does not serialize classes – Does not deal with object name clashes – Needs cooperation from objects to explore object graph Interp. #1 Socket Interp. #2 10/02/09 33Tcl Conference 2009, Portland Oregon
  • 34. Channel Engine Classes • Classes to Make Writing Channels Easy – Based on Andreas Kupries‟s channel API – Both full channels and transformations • Prototype Code on Wiki – http://wiki.tcl.tk/21723 – Introspection to find what features to support 10/02/09 34Tcl Conference 2009, Portland Oregon
  • 35. Megawidgets • Make Tk Widgets with TclOO Objects – Work in “the same” way – Wrap actual widgets • Prototype Code on Wiki – http://wiki.tcl.tk/21103 • Already Driven Two Features Added – The „variable‟ declaration – Improved method forwarding to object-local commands 10/02/09 35Tcl Conference 2009, Portland Oregon
  • 36. Where Next? • TclOO Intended to be Foundation – Fast, light, small, stable, and above all Tcl-ish – It deals with the really complicated bits so you don‟t have to • Features to Add Should be Community- Driven – If you want it, let us know! 10/02/09 36Tcl Conference 2009, Portland Oregon

Editor's Notes

  1. Railway stuff reported at EuroTcl 2009
  2. Extispicy