SlideShare a Scribd company logo
1 of 28
Download to read offline
Smooth Transitions:
Using Tcl 8.5 and upgrading to Tcl 8.6



      Jeff Hobbs
      Director of Engineering
      ActiveState Software Inc.
Agenda
 About ActiveState
 Tcl 8.5 overview
 Tcl 8.5 features in depth
 Tcl 8.6 overview
ActiveState Solutions
ActiveState and Tcl
 ActiveState provides the Tcl community with…
  Improvements to open source Tcl core
  Host of the Tcl Developer Xchange
  Enterprise support infrastructure
    ActiveTcl Business and Enterprise Editions
  Professional services for Tcl
  High quality development tools
    ActiveTcl: batteries-Included free distribution
    Komodo IDE: professional IDE with extensive Tcl support
    Tcl Dev Kit: essential tools for Tcl programmers
    ActiveTcl Pro Studio: Bundle with Tcl Dev Kit, Komodo IDE,
    Safari Online
Tcl 8.5
 Finished after almost 4 years in development
  8.5a1 released March 2004
  8.5.0 final December 2007
  8.5.8 released November 2009
  8.5.9 release ETA September 2010
 Change in state of stable and beta
  8.4.19 last community-based released in April 2008
  8.6a1 development initiated April 2008
Tcl 8.5 changes
 Over 90 new TIPs included in Tcl 8.5
 8.5 is 99.99% backwards compatible with 8.4 at
 the Tcl level
  Exceptions are in error cases
    incr auto-initialize
    No more integer overflow
  Bytecodes have changed - watch version compatibility
    ActiveTcl tbcload can load 8.4 bytecodes in 8.5
Tcl 8.5 expand and dict
 New {*}$aList expansion operator
  Replacement for oft-misused eval
     eval exec [auto_execok start] [list $url]
  => exec {*}[auto_execok start] $url
 New dict data structure
  Order-preserving key/value pairs kept as Tcl_Objs
  More efficient and nestable
  Close pairing with [array get] and lists
  Can replace any use of TclX keyed lists
  Numerous subcommands for filtering, updating data
  Some operations byte-coded
  8.4 emulated version in ActiveTcl
Tcl 8.5 expr
 New expr operators
  ** (exponentation), min, max, isqrt, bool, entier
  in (in list)        expr {“b” in {a b c}} => 1
  ni (not in list), replaces use of lsearch != -1
 New ::tcl::mathfunc namespace for functions
  Define expr functions at the Tcl level
 New ::tcl::mathop namespace for operations
  Allows importing as commands for prefix math
  All functions are byte-compiled
 No more integer overflow because of bignums
Tcl 8.5 bignums
 expr 2 ** 1024
  179769313486231590772930519078902473361797697894230657
  273430081157732675805500963132708477322407536021120113
  879871393357658789768814416622492847430639474124377767
  893424865485276302219601246094119453082952085005768838
  150682342462881473913110540827237163350510684586298239
  947245938479716304835356329624224137216
 Every single bit hand-verified by Kevin Kenny
 Work continuing on performance of bignums
 Bignums available for all expressions, but most
 indexing is still limited to 32-bit values (ie: string
 index, lindex)
 Floating point handling improved to reduce
 rounding errors
Tcl 8.5 list ops
 Added lrepeat, lassign, lreverse
   lassign is as taken from TclX
   lrepeat number element1 ?element2 element3 ...?
 Extended lsort, lsearch
   lsearch -index -nocase -subindices
   lsort -nocase -indices
 List indices now support int[+-]int and end[+-]
 int syntax
Tcl 8.5 namespaces
 namespace ensemble (ensemble commands)
  Adopted from [incr Tcl], useful for subcommand-style
  procedures
  [::carrot::foo] == [::carrot foo]
 namespace unknown (per-namespace unknown
 control)
 namespace path (name resolution control)
 namespace upvar (namespace var efficiency)
Tcl 8.5 clock
 Completely revamped clock command
  64-bit, new parser, ensemble-based
  No more Y2038 issues, even on 32-bit systems
  Full localization support
 Several new subcommands
  clock add
    Simplifies date math operations
  clock microseconds|milliseconds
    Improved resolution
 Clock scan and format updated
  User-specifiable scan formats
  Full set of Olsen timezone data
Tcl 8.5 interp
 Resource limiting with interp limit command
  Time and command count based
 Improved background error handling with interp
 bgerror
 Enhanced debugging with info frame
  Returns current command location and information
  Understands origin (source, proc, eval, precompiled)
 New chan command to consolidate channel
 operations
  Subsumes most f* file id manipulation commands
  Channel reflection exposed at the Tcl level (chan create)
  chan truncate added
Tcl 8.5 packaging
 Enhanced package versioning
   Understand a, b designation in version number (8.5a5)
   Allow for bounded version ranges
   Control preference for stable or latest version available
 Tcl Modules (.tm) package handling
  Intended to improve packaging long term
 tclsh and source -encoding option
 encoding dirs
  Tcl level control of where to find encodings
Tcl 8.5 extras
 Enhanced catch and return
  Make pure Tcl control structures more powerful
 New apply operator for anonymous procedures
 (lambda)
  apply {x {expr {$x*$x}}} 5         =>   25
 Several new binary format codes and improved
 unsigned value support
  %t (tiny/short), %n (normal/int), %m (wide), %r/R (single
  precision real), %q/Q (double precision real), %u (unsigned)
 scan and format have %llx modifiers
 New tcl_platform(pointerSize) element
Tcl 8.5 switch and string
 switch -regexp can provide submatch
 information
  switch -matchvar foo -indexvar bar -regexp -- $string {
     {w*(e)w*} {
         puts "matched [lindex $foo 0] with 'e' at 
         [lindex $bar 1 0]"
     }
     ...

 switch added a -nocase option
 New string is list|wideinteger
 classifications
 New string reverse subcommand
Tcl 8.5 gotchas
 global varName(elemName) raises an error now
  Also for upvar 0 x(1) y(1)
  Was previously an impotent operation that created
  inaccessible variables
 Don’t rely on integer overflow - shouldn’t happen
 list properly quotes the # char
 tcl_precision now defaults to 0
 Auto-initialize for incr
  Previously an undefined var would cause an error
  Gains semantic parity with append, lappend
Tcl 8.6
 Currently in active development
  8.6a1 development initiated April 2008
  8.6b1 released December 2008
  8.6b2 release ETA October 2010
 Release schedule marching towards final
  8.6.0 targeted for 2011
 Over 40 TIPs implemented for 8.6
 Community driven input
  Tcl‘2010, October 2010 in Chicago
    http://www.tcl.tk/community/tcl2010/
Tcl 8.6 OO
 Core OO! (TIP#257,#320)
                                     % oo::class create example {
  Major effort by Donal Fellows        variable foo
  Foundational OO system               constructor {{value 10}} {
                                          set foo 0
  inspired by XOTcl and snit              my bar $value
                                       }
  Provided in core (no package)        destructor { }
  oo::class, oo::define, oo::copy,     method bar {input} {
                                          incr foo $input
  oo::object, ...                      }
  Class-based object system with     }
                                     => ::example
  dynamic redefinition allowed       % example create b 4
                                     => ::b
  Per-object customization with      % b bar 3
  filters, mixins and more           => 7
  Has C API to create and
  manage classes, instances and
  methods
Tcl 8.6 highlights
 Next version of [incr Tcl] (v4) uses TclOO
 New non-recursive bytecode engine
  Enables coroutines, aka generators
    Tcl level coroutines in development
  Proper tailcalls
  Less stack hammering
  C API to allow user commands to be restartable
 Simplified Tcl prefix matching
  C API for option parsing taken from Tk as well
 Thread extension to be included with core sources
  Other extensions being considered
Tcl 8.6 features
 New binary encode|decode with base64
  binary   is now a namespace ensemble
 Ability to cancel script evaluation via interp
 cancel
 Find insertion point in sorted list lsearch -bisect
 Added tcl_platform(pathSeparator) key
 Unicode aware string trim*
 Grouped sort with lsort -stride
 Allow lset to extend lists
  lset myList end+1 foo   equivalent to lappend   myList foo
More 8.6 stuff!
 Many commands accept nothing gracefully
 (TIP#323)
 Base-2 support in format and scan with %b
 New file tempfile ?nameVar? ?template?
  Creates tempfile and returns a channel     set f [open $file a]
 New try/finally syntax                      try {
                                                 puts $f "oops ..."
  try body ?handler...? ?finally script?         # ...
                                             } finally {
       try {                                     close $f
           set f [open $file]                }
       } trap {POSIX EISDIR} {}   {
           puts "failed to open   $file: it's a directory"
       } trap {POSIX ENOENT} {}   {
           puts "failed to open   $file: it doesn't exist"
       }
But wait, there’s more!
 Zlib compression included with new core zlib
 command
  Builds on standard zlib sources
  Full zip and unzip support for gzip and zlib formats
  Supports channel streaming for transforms
  Includes adler32 and crc32 checksumming
  Includes Tcl_Zlib* C API
 Enhanced chan command
  close can close only read or write side
  Anonymous pipes with chan pipe
  Tcl level channel transformations chan push|pop
And on the C side of 8.6
 Make Tcl_Interp opaque
  No more interp->result
    Use Tcl_GetStringResult(interp) instead
  API for interp->errorLine
 Access to startup scripts from C
  Tcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr)
  void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName)

 Portable Tcl_StatBuf access
  Tcl_Get*FromStat
Tcl 8.6 TDBC
     Standard interface for database connectors
      Currently has drivers for sqlite, mysql, odbc and
      postgres
     Leverages TclOO framework
package require tdbc::sqlite3      db transaction {
tdbc::sqlite3::connection create     set firstname "Fred"
   db "phonebook.sqlite3"            set lastname "Flintstone"

                                       $statement foreach row {
set statement [db prepare {
                                         puts [dict get $row phone_num]
 SELECT phone_num FROM directory
                                       }
 WHERE first_name = :firstname     }
 AND last_name = :lastname
}]                                 $statement close
                                   db close
In summary ...
 8.5 is 99% compatible with 8.4 at Tcl level
  Stable and ready for all task loads
 8.6 currently in beta
  Final release ETA 2011
  Lots of new features, with more to come
  Further discussion at Tcl‘2010, October 2010 in Chicago
    http://www.tcl.tk/community/tcl2010/

 Tcl Dev Kit and Komodo support both 8.5 and 8.6
  Later 8.6 changes may require further updates
Q&A

      www.activestate.com
  business-solutions@activestate.com
          Twitter: @activestate
Thank You!
Get Tcl Dev Kit 5:
  Use code ATBE to get $40 off until Sept.15, 2010
Get ActiveTcl Business Edition:
  Use code ATBE to get $200 off until Sept.15, 2010

            Speak to a representative about
     ActiveTcl Enterprise or OEM: 1-866-510-2914
          business-solutions@activestate.com
                 www.activestate.com

More Related Content

More from ActiveState

Robust Algorithms for Machine Learning
Robust Algorithms for Machine LearningRobust Algorithms for Machine Learning
Robust Algorithms for Machine LearningActiveState
 
ActiveState - The Open Source Languages Company
ActiveState - The Open Source Languages CompanyActiveState - The Open Source Languages Company
ActiveState - The Open Source Languages CompanyActiveState
 
ActiveState Open Source Survey - 2016
ActiveState Open Source Survey - 2016ActiveState Open Source Survey - 2016
ActiveState Open Source Survey - 2016ActiveState
 
ActiveState Tcl Survey - 2016
ActiveState Tcl Survey - 2016ActiveState Tcl Survey - 2016
ActiveState Tcl Survey - 2016ActiveState
 
Practical LPeg - Lua Workshop 2016
Practical LPeg - Lua Workshop 2016Practical LPeg - Lua Workshop 2016
Practical LPeg - Lua Workshop 2016ActiveState
 
Overview of Komodo IDE 10.1
Overview of Komodo IDE 10.1Overview of Komodo IDE 10.1
Overview of Komodo IDE 10.1ActiveState
 
The ActiveState of Tcl
The ActiveState of TclThe ActiveState of Tcl
The ActiveState of TclActiveState
 
PERL SURVEY 2016
PERL SURVEY 2016PERL SURVEY 2016
PERL SURVEY 2016ActiveState
 
Improving Customer Experience Using ActivePerl and ActivePython
Improving Customer Experience Using ActivePerl and ActivePythonImproving Customer Experience Using ActivePerl and ActivePython
Improving Customer Experience Using ActivePerl and ActivePythonActiveState
 
Python: The Programmer's Lingua Franca
Python: The Programmer's Lingua FrancaPython: The Programmer's Lingua Franca
Python: The Programmer's Lingua FrancaActiveState
 
Continuing Evolution of Perl: Highlights of ActivePerl 5.14
Continuing Evolution of Perl: Highlights of ActivePerl 5.14Continuing Evolution of Perl: Highlights of ActivePerl 5.14
Continuing Evolution of Perl: Highlights of ActivePerl 5.14ActiveState
 
Looking Ahead to Tcl 8.6
Looking Ahead to Tcl 8.6Looking Ahead to Tcl 8.6
Looking Ahead to Tcl 8.6ActiveState
 
Migrating from matlab to python
Migrating from matlab to pythonMigrating from matlab to python
Migrating from matlab to pythonActiveState
 
US SEC Mandates, Python, and Financial Modeling
US SEC Mandates, Python, and Financial ModelingUS SEC Mandates, Python, and Financial Modeling
US SEC Mandates, Python, and Financial ModelingActiveState
 
ActiveState, CA, Taking quality products to market faster with enterprise rea...
ActiveState, CA, Taking quality products to market faster with enterprise rea...ActiveState, CA, Taking quality products to market faster with enterprise rea...
ActiveState, CA, Taking quality products to market faster with enterprise rea...ActiveState
 
Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12
Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12
Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12ActiveState
 
Python & Finance: US Government Mandates, Financial Modeling, and Other Snake...
Python & Finance: US Government Mandates, Financial Modeling, and Other Snake...Python & Finance: US Government Mandates, Financial Modeling, and Other Snake...
Python & Finance: US Government Mandates, Financial Modeling, and Other Snake...ActiveState
 
Best Practices in Porting & Developing Enterprise Applications to the Cloud u...
Best Practices in Porting & Developing Enterprise Applications to the Cloud u...Best Practices in Porting & Developing Enterprise Applications to the Cloud u...
Best Practices in Porting & Developing Enterprise Applications to the Cloud u...ActiveState
 
Safeguarding Against the Risks of Improper Open Source Licensing - Valuable...
Safeguarding Against the Risks of Improper Open Source Licensing - Valuable...Safeguarding Against the Risks of Improper Open Source Licensing - Valuable...
Safeguarding Against the Risks of Improper Open Source Licensing - Valuable...ActiveState
 

More from ActiveState (20)

Robust Algorithms for Machine Learning
Robust Algorithms for Machine LearningRobust Algorithms for Machine Learning
Robust Algorithms for Machine Learning
 
TDD Pros & Cons
TDD Pros & ConsTDD Pros & Cons
TDD Pros & Cons
 
ActiveState - The Open Source Languages Company
ActiveState - The Open Source Languages CompanyActiveState - The Open Source Languages Company
ActiveState - The Open Source Languages Company
 
ActiveState Open Source Survey - 2016
ActiveState Open Source Survey - 2016ActiveState Open Source Survey - 2016
ActiveState Open Source Survey - 2016
 
ActiveState Tcl Survey - 2016
ActiveState Tcl Survey - 2016ActiveState Tcl Survey - 2016
ActiveState Tcl Survey - 2016
 
Practical LPeg - Lua Workshop 2016
Practical LPeg - Lua Workshop 2016Practical LPeg - Lua Workshop 2016
Practical LPeg - Lua Workshop 2016
 
Overview of Komodo IDE 10.1
Overview of Komodo IDE 10.1Overview of Komodo IDE 10.1
Overview of Komodo IDE 10.1
 
The ActiveState of Tcl
The ActiveState of TclThe ActiveState of Tcl
The ActiveState of Tcl
 
PERL SURVEY 2016
PERL SURVEY 2016PERL SURVEY 2016
PERL SURVEY 2016
 
Improving Customer Experience Using ActivePerl and ActivePython
Improving Customer Experience Using ActivePerl and ActivePythonImproving Customer Experience Using ActivePerl and ActivePython
Improving Customer Experience Using ActivePerl and ActivePython
 
Python: The Programmer's Lingua Franca
Python: The Programmer's Lingua FrancaPython: The Programmer's Lingua Franca
Python: The Programmer's Lingua Franca
 
Continuing Evolution of Perl: Highlights of ActivePerl 5.14
Continuing Evolution of Perl: Highlights of ActivePerl 5.14Continuing Evolution of Perl: Highlights of ActivePerl 5.14
Continuing Evolution of Perl: Highlights of ActivePerl 5.14
 
Looking Ahead to Tcl 8.6
Looking Ahead to Tcl 8.6Looking Ahead to Tcl 8.6
Looking Ahead to Tcl 8.6
 
Migrating from matlab to python
Migrating from matlab to pythonMigrating from matlab to python
Migrating from matlab to python
 
US SEC Mandates, Python, and Financial Modeling
US SEC Mandates, Python, and Financial ModelingUS SEC Mandates, Python, and Financial Modeling
US SEC Mandates, Python, and Financial Modeling
 
ActiveState, CA, Taking quality products to market faster with enterprise rea...
ActiveState, CA, Taking quality products to market faster with enterprise rea...ActiveState, CA, Taking quality products to market faster with enterprise rea...
ActiveState, CA, Taking quality products to market faster with enterprise rea...
 
Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12
Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12
Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12
 
Python & Finance: US Government Mandates, Financial Modeling, and Other Snake...
Python & Finance: US Government Mandates, Financial Modeling, and Other Snake...Python & Finance: US Government Mandates, Financial Modeling, and Other Snake...
Python & Finance: US Government Mandates, Financial Modeling, and Other Snake...
 
Best Practices in Porting & Developing Enterprise Applications to the Cloud u...
Best Practices in Porting & Developing Enterprise Applications to the Cloud u...Best Practices in Porting & Developing Enterprise Applications to the Cloud u...
Best Practices in Porting & Developing Enterprise Applications to the Cloud u...
 
Safeguarding Against the Risks of Improper Open Source Licensing - Valuable...
Safeguarding Against the Risks of Improper Open Source Licensing - Valuable...Safeguarding Against the Risks of Improper Open Source Licensing - Valuable...
Safeguarding Against the Risks of Improper Open Source Licensing - Valuable...
 

ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6

  • 1. Smooth Transitions: Using Tcl 8.5 and upgrading to Tcl 8.6 Jeff Hobbs Director of Engineering ActiveState Software Inc.
  • 2. Agenda About ActiveState Tcl 8.5 overview Tcl 8.5 features in depth Tcl 8.6 overview
  • 4. ActiveState and Tcl ActiveState provides the Tcl community with… Improvements to open source Tcl core Host of the Tcl Developer Xchange Enterprise support infrastructure ActiveTcl Business and Enterprise Editions Professional services for Tcl High quality development tools ActiveTcl: batteries-Included free distribution Komodo IDE: professional IDE with extensive Tcl support Tcl Dev Kit: essential tools for Tcl programmers ActiveTcl Pro Studio: Bundle with Tcl Dev Kit, Komodo IDE, Safari Online
  • 5. Tcl 8.5 Finished after almost 4 years in development 8.5a1 released March 2004 8.5.0 final December 2007 8.5.8 released November 2009 8.5.9 release ETA September 2010 Change in state of stable and beta 8.4.19 last community-based released in April 2008 8.6a1 development initiated April 2008
  • 6. Tcl 8.5 changes Over 90 new TIPs included in Tcl 8.5 8.5 is 99.99% backwards compatible with 8.4 at the Tcl level Exceptions are in error cases incr auto-initialize No more integer overflow Bytecodes have changed - watch version compatibility ActiveTcl tbcload can load 8.4 bytecodes in 8.5
  • 7. Tcl 8.5 expand and dict New {*}$aList expansion operator Replacement for oft-misused eval eval exec [auto_execok start] [list $url] => exec {*}[auto_execok start] $url New dict data structure Order-preserving key/value pairs kept as Tcl_Objs More efficient and nestable Close pairing with [array get] and lists Can replace any use of TclX keyed lists Numerous subcommands for filtering, updating data Some operations byte-coded 8.4 emulated version in ActiveTcl
  • 8. Tcl 8.5 expr New expr operators ** (exponentation), min, max, isqrt, bool, entier in (in list) expr {“b” in {a b c}} => 1 ni (not in list), replaces use of lsearch != -1 New ::tcl::mathfunc namespace for functions Define expr functions at the Tcl level New ::tcl::mathop namespace for operations Allows importing as commands for prefix math All functions are byte-compiled No more integer overflow because of bignums
  • 9. Tcl 8.5 bignums expr 2 ** 1024 179769313486231590772930519078902473361797697894230657 273430081157732675805500963132708477322407536021120113 879871393357658789768814416622492847430639474124377767 893424865485276302219601246094119453082952085005768838 150682342462881473913110540827237163350510684586298239 947245938479716304835356329624224137216 Every single bit hand-verified by Kevin Kenny Work continuing on performance of bignums Bignums available for all expressions, but most indexing is still limited to 32-bit values (ie: string index, lindex) Floating point handling improved to reduce rounding errors
  • 10. Tcl 8.5 list ops Added lrepeat, lassign, lreverse lassign is as taken from TclX lrepeat number element1 ?element2 element3 ...? Extended lsort, lsearch lsearch -index -nocase -subindices lsort -nocase -indices List indices now support int[+-]int and end[+-] int syntax
  • 11. Tcl 8.5 namespaces namespace ensemble (ensemble commands) Adopted from [incr Tcl], useful for subcommand-style procedures [::carrot::foo] == [::carrot foo] namespace unknown (per-namespace unknown control) namespace path (name resolution control) namespace upvar (namespace var efficiency)
  • 12. Tcl 8.5 clock Completely revamped clock command 64-bit, new parser, ensemble-based No more Y2038 issues, even on 32-bit systems Full localization support Several new subcommands clock add Simplifies date math operations clock microseconds|milliseconds Improved resolution Clock scan and format updated User-specifiable scan formats Full set of Olsen timezone data
  • 13. Tcl 8.5 interp Resource limiting with interp limit command Time and command count based Improved background error handling with interp bgerror Enhanced debugging with info frame Returns current command location and information Understands origin (source, proc, eval, precompiled) New chan command to consolidate channel operations Subsumes most f* file id manipulation commands Channel reflection exposed at the Tcl level (chan create) chan truncate added
  • 14. Tcl 8.5 packaging Enhanced package versioning Understand a, b designation in version number (8.5a5) Allow for bounded version ranges Control preference for stable or latest version available Tcl Modules (.tm) package handling Intended to improve packaging long term tclsh and source -encoding option encoding dirs Tcl level control of where to find encodings
  • 15. Tcl 8.5 extras Enhanced catch and return Make pure Tcl control structures more powerful New apply operator for anonymous procedures (lambda) apply {x {expr {$x*$x}}} 5 => 25 Several new binary format codes and improved unsigned value support %t (tiny/short), %n (normal/int), %m (wide), %r/R (single precision real), %q/Q (double precision real), %u (unsigned) scan and format have %llx modifiers New tcl_platform(pointerSize) element
  • 16. Tcl 8.5 switch and string switch -regexp can provide submatch information switch -matchvar foo -indexvar bar -regexp -- $string { {w*(e)w*} { puts "matched [lindex $foo 0] with 'e' at [lindex $bar 1 0]" } ... switch added a -nocase option New string is list|wideinteger classifications New string reverse subcommand
  • 17. Tcl 8.5 gotchas global varName(elemName) raises an error now Also for upvar 0 x(1) y(1) Was previously an impotent operation that created inaccessible variables Don’t rely on integer overflow - shouldn’t happen list properly quotes the # char tcl_precision now defaults to 0 Auto-initialize for incr Previously an undefined var would cause an error Gains semantic parity with append, lappend
  • 18. Tcl 8.6 Currently in active development 8.6a1 development initiated April 2008 8.6b1 released December 2008 8.6b2 release ETA October 2010 Release schedule marching towards final 8.6.0 targeted for 2011 Over 40 TIPs implemented for 8.6 Community driven input Tcl‘2010, October 2010 in Chicago http://www.tcl.tk/community/tcl2010/
  • 19. Tcl 8.6 OO Core OO! (TIP#257,#320) % oo::class create example { Major effort by Donal Fellows variable foo Foundational OO system constructor {{value 10}} { set foo 0 inspired by XOTcl and snit my bar $value } Provided in core (no package) destructor { } oo::class, oo::define, oo::copy, method bar {input} { incr foo $input oo::object, ... } Class-based object system with } => ::example dynamic redefinition allowed % example create b 4 => ::b Per-object customization with % b bar 3 filters, mixins and more => 7 Has C API to create and manage classes, instances and methods
  • 20. Tcl 8.6 highlights Next version of [incr Tcl] (v4) uses TclOO New non-recursive bytecode engine Enables coroutines, aka generators Tcl level coroutines in development Proper tailcalls Less stack hammering C API to allow user commands to be restartable Simplified Tcl prefix matching C API for option parsing taken from Tk as well Thread extension to be included with core sources Other extensions being considered
  • 21. Tcl 8.6 features New binary encode|decode with base64 binary is now a namespace ensemble Ability to cancel script evaluation via interp cancel Find insertion point in sorted list lsearch -bisect Added tcl_platform(pathSeparator) key Unicode aware string trim* Grouped sort with lsort -stride Allow lset to extend lists lset myList end+1 foo equivalent to lappend myList foo
  • 22. More 8.6 stuff! Many commands accept nothing gracefully (TIP#323) Base-2 support in format and scan with %b New file tempfile ?nameVar? ?template? Creates tempfile and returns a channel set f [open $file a] New try/finally syntax try { puts $f "oops ..." try body ?handler...? ?finally script? # ... } finally { try { close $f set f [open $file] } } trap {POSIX EISDIR} {} { puts "failed to open $file: it's a directory" } trap {POSIX ENOENT} {} { puts "failed to open $file: it doesn't exist" }
  • 23. But wait, there’s more! Zlib compression included with new core zlib command Builds on standard zlib sources Full zip and unzip support for gzip and zlib formats Supports channel streaming for transforms Includes adler32 and crc32 checksumming Includes Tcl_Zlib* C API Enhanced chan command close can close only read or write side Anonymous pipes with chan pipe Tcl level channel transformations chan push|pop
  • 24. And on the C side of 8.6 Make Tcl_Interp opaque No more interp->result Use Tcl_GetStringResult(interp) instead API for interp->errorLine Access to startup scripts from C Tcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr) void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName) Portable Tcl_StatBuf access Tcl_Get*FromStat
  • 25. Tcl 8.6 TDBC Standard interface for database connectors Currently has drivers for sqlite, mysql, odbc and postgres Leverages TclOO framework package require tdbc::sqlite3 db transaction { tdbc::sqlite3::connection create set firstname "Fred" db "phonebook.sqlite3" set lastname "Flintstone" $statement foreach row { set statement [db prepare { puts [dict get $row phone_num] SELECT phone_num FROM directory } WHERE first_name = :firstname } AND last_name = :lastname }] $statement close db close
  • 26. In summary ... 8.5 is 99% compatible with 8.4 at Tcl level Stable and ready for all task loads 8.6 currently in beta Final release ETA 2011 Lots of new features, with more to come Further discussion at Tcl‘2010, October 2010 in Chicago http://www.tcl.tk/community/tcl2010/ Tcl Dev Kit and Komodo support both 8.5 and 8.6 Later 8.6 changes may require further updates
  • 27. Q&A www.activestate.com business-solutions@activestate.com Twitter: @activestate
  • 28. Thank You! Get Tcl Dev Kit 5: Use code ATBE to get $40 off until Sept.15, 2010 Get ActiveTcl Business Edition: Use code ATBE to get $200 off until Sept.15, 2010 Speak to a representative about ActiveTcl Enterprise or OEM: 1-866-510-2914 business-solutions@activestate.com www.activestate.com