Looking Ahead to Tcl 8.6


Jeff Hobbs
Director, Engineering
ActiveState Software Inc.
Agenda
 About ActiveState

 Tcl 8.6 roadmap

 Tcl 8.6 features in depth
  Knowledge of Tcl 8.5 expected
  For 8.5 review, see previous webinar:
    https://www1.gotomeeting.com/register/446757680

 Q&A
About ActiveState
 The Dynamic Language Experts
  Over 10 years focusing on open source dynamic
  languages
  Experience across multiple dynamic languages
   Tcl, Perl, PHP, Python, Ruby, JS
  And platforms
   AIX, HP-UX, Linux, Mac OS X, Solaris, Windows, …
 Assist in the development, management and
 distribution of dynamic languages
  97% of Fortune 1000 companies use ActiveState
  products
ActiveState Languages Universe
Tcl/Tk 8.6 Roadmap
 Currently in active development
  8.6a1 development initiated April 2008
    Same month of 8.4.19 release
  8.6b1 released December 2008
  8.6b2 coming soon
 Release schedule marching towards final
  8.6.0 targeted for 2011
 Community input is important
Tcl/Tk 8.6 Changes
 Numerous TIPs implemented for 8.6
  49 TIPs final (1 more in accepted state)
    8 more in draft state
  70 TIPs targeting 8.7 (in draft state)
    7 TIPs targeting 9.0
 99.9% compatible with Tcl 8.5
  Changes are in error messages
  Bytecodes have changed - watch version compatibility
    ActiveTcl tbcload can load 8.5 bytecodes in 8.6
    Separate Tcl Dev Kit bytecode compilers for 8.5 and 8.6
Tcl 8.6 OO
 Core OO! (T257 T320 T354)
                                     % 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 string and list handling
 Simplified Tcl prefix matching (T195)
   tcl::prefix,   with C API for option parsing (T265)
 Unicode aware string trim* (T318)
 Find insertion point in sorted list lsearch -bisect
 (T313)
 Grouped sort with lsort -stride (T326)
  Great for use with array get or dict output
 Allow lset to extend lists (T331)
  lset myList end+1 foo equivalent to lappend     myList foo
Tcl 8.6 interp and namespace
 Ability to cancel script evaluation (T285)
  interp cancel,  C API helper Tcl_CancelEval
  Check if interp is active Tcl_InterpActive (T335)
 namespace ensemble create -parameters (T314)
 encoding system at startup is iso8859-1, not
 identity
 info errorstack, -errorstack return dict (T348)
 tcl::unsupported::representation
  Get Tcl_Obj internal rep
Tcl 8.6 extras
 New binary encode|decode with base64 (T317)
  binary   is now a namespace ensemble
 Base-2 support in format and scan with %b (T343)
 dict filter takes multiple patterns args (T341)
 Windows registry has 64-bit support (T362)
 Added tcl_platform(pathSeparator) key (T315)
  For $::env(PATH), not file paths (use file)
More 8.6 stuff!
 More commands take no args gracefully (T323)
  Reduce non-essential error cases, good with {*}

 New try/finally syntax (T329)             set f [open $file a]
                                           try {
  try body ?handler...? ?finally script?
                                               puts $f "oops ..."
  throw type message                           # ...
    Alternative to error                   } finally {
                                               close $f
                                           }
   try {
       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"
   }
Tcl 8.6 files and channels
 New file tempfile ?nameVar? ?template?
  Creates tempfile and returns a channel (T210)
 Enhanced chan command
  close can close only read or write side (T332)
  Anonymous pipes with chan pipe (T304)
  Tcl level channel transformations chan push|pop (T230)
 IPv6 support in socket (T162)
  Currently uses OS preference for AF selection
But wait, there’s more!
 Zlib compression included with new core zlib
 command (T234)
  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
And on the C side of 8.6
 Make Tcl_Interp more opaque
  No more interp->result (T330)
   Use Tcl_GetStringResult(interp) instead
  API for interp->errorLine (T336)
    Tcl_Get|SetErrorLine
 Access to startup scripts from C (T338)
  Tcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr)
  void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName)

 Exported Tcl_TransferResult (T307)
 Portable Tcl_StatBuf access (T316)
  Tcl_Get*FromStat
 New Tcl_BackgroundException for bgerror (T337)
More 8.6 Under the Hood
 Exported library loading functions (T357)
  Tcl_LoadFile, Tcl_FindSymbol, Tcl_FSUnloadFile
 Windows moving to full -DUNICODE build
  Supports Windows XP or later
 OS X moving to Cocoa
  Supports OS X 10.5 or later, allows 64-bit builds
 Next version of [incr Tcl] (v4) uses TclOO
 Thread extension to be included with core sources
  Thread builds (--enable-threads) now default (T364)
  Other extensions being considered
Tcl 8.6 TDBC
     Standard interface for database connectors (T308)
      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"


set statement [db prepare {            $statement foreach row {
 SELECT phone_num FROM directory         puts [dict get $row phone_num]
                                       }
 WHERE first_name = :firstname
                                   }
 AND last_name = :lastname
}]                                 $statement close
                                   db close
Tk 8.6 Features
 Windows Vista/7 theme support for Ttk
  Backported to 8.5.8
 Updated mouse-wheel behavior (T171)
 Tk OS X Cocoa
  Enables 64-bit builds
  Requires OS X 10.5+
  Available for Tk 8.5
 New canvas features
  Absolute canvas item positioning (T236)
  Canvas item vertex editing (T97)
  Angled text items (T119)
Tk 8.6 font dialog
 Uses native dialog on Windows, OS X (T324)
 % tk fontchooser show
 % tk fontchooser configure
 -parent . -title {} -font {{Gill Sans} 12 bold roman}
 -command {} -visible 1
Tk 8.6 PNG support
 Full PNG support with compression (T244)
  Leverages zlib support
 image create photo -file ouster.png 
                    -format "png -alpha 0.5"
Tk 8.6 extras
 New tk busy adapted from BLT’s busy (T321)
 User can generate <Focus*> events
 Unfocussed text insertion cursor control (T197)
 GIF image writing uses LZW compression
 wm attributes -type on X11 (T359)
 Modernized X11 menus (T360)
 New ttk::spinbox widget (also in 8.5.9)
  Consider the alternate widgets combobox and menubutton
In summary ...
 8.6 currently in beta
  99.9% compatible with Tcl 8.5
    Changes in error messages
    New features bring new core commands (e.g. try)
    Internal bytecodes have changed
  Almost 50 new features for developers
    Possibly a few more to come
    Slower than 8.5, performance wasn’t a focus
  Final release ETA 2011

 Tcl Dev Kit and Komodo support both 8.5 and 8.6
  Further 8.6 changes may require further updates
ActiveTcl 8.6.0.0 Beta 4
 Based on 8.6b1.2 Tcl core
  Released October 2010
  Incudes VFS Explorer (tclvfse)
 Similar to ActiveTcl 8.5 extension set
  Adds new core modules for TDBC, trofs
  90+ packages - the rest available via teacup
 Mac OS X architecture change
  Was x86-ppc “universal” with Carbon
  Now x86-x64 with Cocoa
  teapot understands both architectures
Q&A

      www.activestate.com
  business-solutions@activestate.com
          Twitter: @activestate
Thank You!
Next Steps ...
  Watch our webinar, Exploring the Benefits of Embedding
  Dynamic Scripting Languages in Your Products

  http://www.activestate.com/webinars/exploring-benefits-
  embedding-dynamic-scripting



            or speak to a representative about
      ActiveTcl Enterprise or OEM: 1-778-786-1107
           business-solutions@activestate.com
                  www.activestate.com

Looking Ahead to Tcl 8.6

  • 1.
    Looking Ahead toTcl 8.6 Jeff Hobbs Director, Engineering ActiveState Software Inc.
  • 2.
    Agenda About ActiveState Tcl 8.6 roadmap Tcl 8.6 features in depth Knowledge of Tcl 8.5 expected For 8.5 review, see previous webinar: https://www1.gotomeeting.com/register/446757680 Q&A
  • 3.
    About ActiveState TheDynamic Language Experts Over 10 years focusing on open source dynamic languages Experience across multiple dynamic languages Tcl, Perl, PHP, Python, Ruby, JS And platforms AIX, HP-UX, Linux, Mac OS X, Solaris, Windows, … Assist in the development, management and distribution of dynamic languages 97% of Fortune 1000 companies use ActiveState products
  • 4.
  • 5.
    Tcl/Tk 8.6 Roadmap Currently in active development 8.6a1 development initiated April 2008 Same month of 8.4.19 release 8.6b1 released December 2008 8.6b2 coming soon Release schedule marching towards final 8.6.0 targeted for 2011 Community input is important
  • 6.
    Tcl/Tk 8.6 Changes Numerous TIPs implemented for 8.6 49 TIPs final (1 more in accepted state) 8 more in draft state 70 TIPs targeting 8.7 (in draft state) 7 TIPs targeting 9.0 99.9% compatible with Tcl 8.5 Changes are in error messages Bytecodes have changed - watch version compatibility ActiveTcl tbcload can load 8.5 bytecodes in 8.6 Separate Tcl Dev Kit bytecode compilers for 8.5 and 8.6
  • 7.
    Tcl 8.6 OO Core OO! (T257 T320 T354) % 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
  • 8.
    Tcl 8.6 stringand list handling Simplified Tcl prefix matching (T195) tcl::prefix, with C API for option parsing (T265) Unicode aware string trim* (T318) Find insertion point in sorted list lsearch -bisect (T313) Grouped sort with lsort -stride (T326) Great for use with array get or dict output Allow lset to extend lists (T331) lset myList end+1 foo equivalent to lappend myList foo
  • 9.
    Tcl 8.6 interpand namespace Ability to cancel script evaluation (T285) interp cancel, C API helper Tcl_CancelEval Check if interp is active Tcl_InterpActive (T335) namespace ensemble create -parameters (T314) encoding system at startup is iso8859-1, not identity info errorstack, -errorstack return dict (T348) tcl::unsupported::representation Get Tcl_Obj internal rep
  • 10.
    Tcl 8.6 extras New binary encode|decode with base64 (T317) binary is now a namespace ensemble Base-2 support in format and scan with %b (T343) dict filter takes multiple patterns args (T341) Windows registry has 64-bit support (T362) Added tcl_platform(pathSeparator) key (T315) For $::env(PATH), not file paths (use file)
  • 11.
    More 8.6 stuff! More commands take no args gracefully (T323) Reduce non-essential error cases, good with {*} New try/finally syntax (T329) set f [open $file a] try { try body ?handler...? ?finally script? puts $f "oops ..." throw type message # ... Alternative to error } finally { close $f } try { 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" }
  • 12.
    Tcl 8.6 filesand channels New file tempfile ?nameVar? ?template? Creates tempfile and returns a channel (T210) Enhanced chan command close can close only read or write side (T332) Anonymous pipes with chan pipe (T304) Tcl level channel transformations chan push|pop (T230) IPv6 support in socket (T162) Currently uses OS preference for AF selection
  • 13.
    But wait, there’smore! Zlib compression included with new core zlib command (T234) 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
  • 14.
    And on theC side of 8.6 Make Tcl_Interp more opaque No more interp->result (T330) Use Tcl_GetStringResult(interp) instead API for interp->errorLine (T336) Tcl_Get|SetErrorLine Access to startup scripts from C (T338) Tcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr) void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName) Exported Tcl_TransferResult (T307) Portable Tcl_StatBuf access (T316) Tcl_Get*FromStat New Tcl_BackgroundException for bgerror (T337)
  • 15.
    More 8.6 Underthe Hood Exported library loading functions (T357) Tcl_LoadFile, Tcl_FindSymbol, Tcl_FSUnloadFile Windows moving to full -DUNICODE build Supports Windows XP or later OS X moving to Cocoa Supports OS X 10.5 or later, allows 64-bit builds Next version of [incr Tcl] (v4) uses TclOO Thread extension to be included with core sources Thread builds (--enable-threads) now default (T364) Other extensions being considered
  • 16.
    Tcl 8.6 TDBC Standard interface for database connectors (T308) 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" set statement [db prepare { $statement foreach row { SELECT phone_num FROM directory puts [dict get $row phone_num] } WHERE first_name = :firstname } AND last_name = :lastname }] $statement close db close
  • 17.
    Tk 8.6 Features Windows Vista/7 theme support for Ttk Backported to 8.5.8 Updated mouse-wheel behavior (T171) Tk OS X Cocoa Enables 64-bit builds Requires OS X 10.5+ Available for Tk 8.5 New canvas features Absolute canvas item positioning (T236) Canvas item vertex editing (T97) Angled text items (T119)
  • 18.
    Tk 8.6 fontdialog Uses native dialog on Windows, OS X (T324) % tk fontchooser show % tk fontchooser configure -parent . -title {} -font {{Gill Sans} 12 bold roman} -command {} -visible 1
  • 19.
    Tk 8.6 PNGsupport Full PNG support with compression (T244) Leverages zlib support image create photo -file ouster.png -format "png -alpha 0.5"
  • 20.
    Tk 8.6 extras New tk busy adapted from BLT’s busy (T321) User can generate <Focus*> events Unfocussed text insertion cursor control (T197) GIF image writing uses LZW compression wm attributes -type on X11 (T359) Modernized X11 menus (T360) New ttk::spinbox widget (also in 8.5.9) Consider the alternate widgets combobox and menubutton
  • 21.
    In summary ... 8.6 currently in beta 99.9% compatible with Tcl 8.5 Changes in error messages New features bring new core commands (e.g. try) Internal bytecodes have changed Almost 50 new features for developers Possibly a few more to come Slower than 8.5, performance wasn’t a focus Final release ETA 2011 Tcl Dev Kit and Komodo support both 8.5 and 8.6 Further 8.6 changes may require further updates
  • 22.
    ActiveTcl 8.6.0.0 Beta4 Based on 8.6b1.2 Tcl core Released October 2010 Incudes VFS Explorer (tclvfse) Similar to ActiveTcl 8.5 extension set Adds new core modules for TDBC, trofs 90+ packages - the rest available via teacup Mac OS X architecture change Was x86-ppc “universal” with Carbon Now x86-x64 with Cocoa teapot understands both architectures
  • 23.
    Q&A www.activestate.com business-solutions@activestate.com Twitter: @activestate
  • 24.
    Thank You! Next Steps... Watch our webinar, Exploring the Benefits of Embedding Dynamic Scripting Languages in Your Products http://www.activestate.com/webinars/exploring-benefits- embedding-dynamic-scripting or speak to a representative about ActiveTcl Enterprise or OEM: 1-778-786-1107 business-solutions@activestate.com www.activestate.com