tcl2012 8.6 changes

19
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

Upload: hobbs

Post on 20-Jun-2015

574 views

Category:

Technology


0 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Tcl2012 8.6 Changes

Tcl/Tk 8.6

Current development branch (or 9.0?)In final release candidates right now

8.6a1 development initiated April 2008Same month of 8.4.19 release

8.6b1 released December 20088.6b2 released August 20118.6b3 released September 20128.6.0 in RC now

Page 2: Tcl2012 8.6 Changes

Tcl/Tk 8.6 TIPs

Numerous TIPs implemented for 8.665 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 20101 withdrawn, 1 rejected

Page 3: Tcl2012 8.6 Changes

Tcl 8.6 OO

Core OO! (T257 T320 T354 T380 T381 T397)

Foundational OO system inspired by XOTcl and snitProvided in core (no package)oo::class, oo::define, oo::copy, oo::object, ...Class-based object system with dynamic redefinition allowedPer-object customization with filters, mixins and moreHas C API to create and manage classes, instances and methods

% oo::class create example { variable foo constructor {{value 10}} { set foo 0 my bar $value } destructor { } method bar {input} { incr foo $input }}=> ::example% example create b 4=> ::b% b bar 3=> 7

Page 4: Tcl2012 8.6 Changes

Tcl 8.6 NRE

New non-recursive bytecode engineLess stack hammering (aka stackless)

Proper tailcalls (T327)

Enables coroutines, aka generatorscoroutine, info coroutine, yield (T328)

Symmetric coroutines, multiples args, yieldto (T396)tcl::unsupported::yieldTo/yieldm

Coroutines still in developmentC API to allow user commands to be restartableTcl_NR* (T322 T353 T356)Not all Tcl commands can yield

Page 5: Tcl2012 8.6 Changes

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 addedNew string is entier (T395)

Number of any size (accounts for bignums)

Page 6: Tcl2012 8.6 Changes

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 applyset good [lmap x $vals {expr {[isGood $x] ? $x : [continue]}}]

Page 7: Tcl2012 8.6 Changes

Tcl 8.6 interp and namespace

Ability to cancel script evaluation (T285)interp cancel, C API helper Tcl_CancelEvalCheck if interp is active Tcl_InterpActive (T335)

namespace ensemble create -parameters (T314)

encoding system at startup is iso8859-1, not identityinfo errorstack, -errorstack return dict (T348)tcl::unsupported::representation

Get Tcl_Obj internal rep

Page 8: Tcl2012 8.6 Changes

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)

Page 9: Tcl2012 8.6 Changes

More 8.6 stuff!

More commands take no args gracefully (T323)Reduce non-essential error cases, good with {*}

New try/finally syntax (T329)try body ?handler...? ?finally script?throw type message

Alternative to error

set f [open $file a]try { puts $f "oops ..." # ...} 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"}

Page 10: Tcl2012 8.6 Changes

Tcl 8.6 files and channels

New file tempfile ?nameVar? ?template?Creates tempfile and returns a channel (T210)

Enhanced chan commandclose 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)

Page 11: Tcl2012 8.6 Changes

But wait, there’s more!

Zlib compression included with new core zlib command (T234 T400)

Builds on standard zlib sourcesFull zip and unzip support for gzip and zlib formatsSupports channel streaming for transformsIncludes adler32 and crc32 checksummingIncludes Tcl_Zlib* C API

Page 12: Tcl2012 8.6 Changes

And on the C side of 8.6

Make Tcl_Interp more opaqueNo more interp->result (T330)

Use Tcl_GetStringResult(interp) insteadAPI 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)

Page 13: Tcl2012 8.6 Changes

More 8.6 Under the Hood

Exported library loading functions (T357)Tcl_LoadFile, Tcl_FindSymbol, Tcl_FSUnloadFile

Windows moving to full -DUNICODE buildSupports Windows XP or later

OS X moving to CocoaSupports OS X 10.5 or later, allows 64-bit builds

Next version of [incr Tcl] (v4) uses TclOOThread extension to be included with core sources

Thread builds (--enable-threads) now default (T364)Several other extensions included too

Page 14: Tcl2012 8.6 Changes

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

tdbc::sqlite3::connection create db "phonebook.sqlite3"

set statement [db prepare {

SELECT phone_num FROM directory

WHERE first_name = :firstname

AND last_name = :lastname

}]

db transaction { set firstname "Fred" set lastname "Flintstone"

$statement foreach row { puts [dict get $row phone_num] }}

$statement closedb close

Page 15: Tcl2012 8.6 Changes

Tk 8.6 Features

Windows Vista/7 theme support for TtkBackported to 8.5.8

Updated mouse-wheel behavior (T171)

Tk OS X CocoaEnables 64-bit buildsRequires OS X 10.5+Available for Tk 8.5

New canvas featuresAbsolute canvas item positioning (T236)Canvas item vertex editing (T97)Angled text items (T119)

Page 16: Tcl2012 8.6 Changes

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

Page 17: Tcl2012 8.6 Changes

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"

Page 18: Tcl2012 8.6 Changes

Tk 8.6 extras

New tk busy adapted from BLT’s busy (T321)

User can generate <Focus*> eventsUnfocussed text insertion cursor control (T197)

GIF image writing uses LZW compressionwm 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

Page 19: Tcl2012 8.6 Changes

In summary ...

8.5 is 99% compatible with 8.4 at Tcl levelOver 100 new features for developersStable and ready for all task loads

Slightly slower than 8.48.6 currently in final RC

Final release date: taking bets!Lots of new features

Slightly slower than 8.5, performance wasn’t a focusFurther discussion at the conference

Tcl Dev Kit and Komodo support both 8.5 and 8.6Final 8.6 will require further an update