Tcl2012 8.6 Changes


Published on

Slide section from the Tcl 2012 State of Tcl talk that goes over the changes in Tcl 8.6 in point friendly format.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Tcl2012 8.6 Changes

  1. 1. Tcl/Tk 8.6 Current development branch (or 9.0?) In final release candidates right now 8.6a1 development initiated April 2008 Same month of 8.4.19 release 8.6b1 released December 2008 8.6b2 released August 2011 8.6b3 released September 2012 8.6.0 in RC now
  2. 2. Tcl/Tk 8.6 TIPs Numerous TIPs implemented for 8.6 65 TIPs Final +14 from 2011; +3 previous year +1 also in 8.5.11 (tk_getSaveFile change) 1 more in accepted state (T399) 5 more in Draft state (3 redundant or out-dated) 81 TIPs targeting 8.7 (in Draft state) 3 more already Withdrawn +9 from 2011; +5 previous year 7 TIPs targeting 9.0 (in Draft state) +0 since 2010 1 withdrawn, 1 rejected
  3. 3. Tcl 8.6 OO Core OO! (T257 T320 T354 T380 T381 T397) % oo::class create example { variable foo Foundational OO system constructor {{value 10}} { inspired by XOTcl and snit set foo 0 my bar $value Provided in core (no package) } destructor { } oo::class, oo::define, oo::copy, method bar {input} { oo::object, ... incr foo $input } Class-based object system with } => ::example dynamic redefinition allowed % example create b 4 Per-object customization with => ::b % b bar 3 filters, mixins and more => 7 Has C API to create and manage classes, instances and methods
  4. 4. Tcl 8.6 NRE New non-recursive bytecode engine Less stack hammering (aka stackless) Proper tailcalls (T327) Enables coroutines, aka generators coroutine, info coroutine, yield (T328) Symmetric coroutines, multiples args, yieldto (T396) tcl::unsupported::yieldTo/yieldm Coroutines still in development C API to allow user commands to be restartable Tcl_NR* (T322 T353 T356) Not all Tcl commands can yield
  5. 5. Tcl 8.6 string handling Simplified Tcl prefix matching (T195) tcl::prefix, with C API for option parsing (T265) Unicode aware string is space/trim* (T318 T413) BOM and zero-width spaces added New string is entier (T395) Number of any size (accounts for bignums)
  6. 6. Tcl 8.6 list handling 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 Collecting loops with lmap and dict map (T405) Simplified (and faster) than foreach or apply set good [lmap x $vals {expr {[isGood $x] ? $x : [continue]}}]
  7. 7. 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
  8. 8. 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) Unicode literals past the BMP (T388) load adds -global and -lazy options (T416)
  9. 9. 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: its a directory" } trap {POSIX ENOENT} {} { puts "failed to open $file: it doesnt exist" }
  10. 10. 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 Exit quickly with non-blocking block channels (T398)
  11. 11. But wait, there’s more! Zlib compression included with new core zlib command (T234 T400) 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
  12. 12. 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)
  13. 13. 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) Several other extensions included too
  14. 14. Tcl 8.6 TDBC Standard interface for database connectors (T308) Currently has drivers for sqlite, mysql, odbc and postgres Leverages TclOO frameworkpackage 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
  15. 15. 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)
  16. 16. 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
  17. 17. 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"
  18. 18. 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) Web colors for Tk (T403) New ttk::spinbox widget (also in 8.5.9) Consider the alternate widgets combobox and menubutton
  19. 19. In summary ... 8.5 is 99% compatible with 8.4 at Tcl level Over 100 new features for developers Stable and ready for all task loads Slightly slower than 8.4 8.6 currently in final RC Final release date: taking bets! Lots of new features Slightly slower than 8.5, performance wasn’t a focus Further discussion at the conference Tcl Dev Kit and Komodo support both 8.5 and 8.6 Final 8.6 will require further an update