ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6
-
Upload
activestate -
Category
Documents
-
view
1.149 -
download
6
Transcript of ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6
![Page 1: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/1.jpg)
Smooth Transitions:Using Tcl 8.5 and upgrading to Tcl 8.6
Jeff HobbsDirector of EngineeringActiveState Software Inc.
![Page 2: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/2.jpg)
Agenda
About ActiveStateTcl 8.5 overviewTcl 8.5 features in depthTcl 8.6 overview
![Page 3: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/3.jpg)
ActiveState Solutions
![Page 4: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/4.jpg)
ActiveState and Tcl
ActiveState provides the Tcl community with…Improvements to open source Tcl coreHost of the Tcl Developer XchangeEnterprise support infrastructure
ActiveTcl Business and Enterprise EditionsProfessional services for TclHigh quality development tools
ActiveTcl: batteries-Included free distributionKomodo IDE: professional IDE with extensive Tcl supportTcl Dev Kit: essential tools for Tcl programmersActiveTcl Pro Studio: Bundle with Tcl Dev Kit, Komodo IDE, Safari Online
![Page 5: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/5.jpg)
Tcl 8.5
Finished after almost 4 years in development8.5a1 released March 20048.5.0 final December 20078.5.8 released November 20098.5.9 release ETA September 2010
Change in state of stable and beta8.4.19 last community-based released in April 20088.6a1 development initiated April 2008
![Page 6: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/6.jpg)
Tcl 8.5 changes
Over 90 new TIPs included in Tcl 8.58.5 is 99.99% backwards compatible with 8.4 at the Tcl level
Exceptions are in error casesincr auto-initializeNo more integer overflow
Bytecodes have changed - watch version compatibilityActiveTcl tbcload can load 8.4 bytecodes in 8.5
![Page 7: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/7.jpg)
Tcl 8.5 expand and dict
New {*}$aList expansion operatorReplacement for oft-misused eval eval exec [auto_execok start] [list $url]=> exec {*}[auto_execok start] $url
New dict data structureOrder-preserving key/value pairs kept as Tcl_ObjsMore efficient and nestableClose pairing with [array get] and listsCan replace any use of TclX keyed listsNumerous subcommands for filtering, updating dataSome operations byte-coded8.4 emulated version in ActiveTcl
![Page 8: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/8.jpg)
Tcl 8.5 expr
New expr operators** (exponentation), min, max, isqrt, bool, entierin (in list) expr {“b” in {a b c}} => 1ni (not in list), replaces use of lsearch != -1
New ::tcl::mathfunc namespace for functionsDefine expr functions at the Tcl level
New ::tcl::mathop namespace for operationsAllows importing as commands for prefix mathAll functions are byte-compiled
No more integer overflow because of bignums
![Page 9: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/9.jpg)
Tcl 8.5 bignumsexpr 2 ** 1024179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216
Every single bit hand-verified by Kevin KennyWork continuing on performance of bignumsBignums 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
![Page 10: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/10.jpg)
Tcl 8.5 list ops
Added lrepeat, lassign, lreverselassign is as taken from TclXlrepeat number element1 ?element2 element3 ...?
Extended lsort, lsearchlsearch -index -nocase -subindiceslsort -nocase -indices
List indices now support int[+-]int and end[+-]int syntax
![Page 11: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/11.jpg)
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)
![Page 12: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/12.jpg)
Tcl 8.5 clock
Completely revamped clock command64-bit, new parser, ensemble-basedNo more Y2038 issues, even on 32-bit systemsFull localization support
Several new subcommandsclock add
Simplifies date math operationsclock microseconds|milliseconds
Improved resolutionClock scan and format updated
User-specifiable scan formatsFull set of Olsen timezone data
![Page 13: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/13.jpg)
Tcl 8.5 interp
Resource limiting with interp limit commandTime and command count based
Improved background error handling with interp bgerrorEnhanced debugging with info frame
Returns current command location and informationUnderstands origin (source, proc, eval, precompiled)
New chan command to consolidate channel operations
Subsumes most f* file id manipulation commandsChannel reflection exposed at the Tcl level (chan create)chan truncate added
![Page 14: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/14.jpg)
Tcl 8.5 packaging
Enhanced package versioningUnderstand a, b designation in version number (8.5a5)Allow for bounded version rangesControl preference for stable or latest version available
Tcl Modules (.tm) package handlingIntended to improve packaging long term
tclsh and source -encoding optionencoding dirs
Tcl level control of where to find encodings
![Page 15: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/15.jpg)
Tcl 8.5 extras
Enhanced catch and returnMake 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 modifiersNew tcl_platform(pointerSize) element
![Page 16: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/16.jpg)
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 optionNew string is list|wideinteger classificationsNew string reverse subcommand
![Page 17: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/17.jpg)
Tcl 8.5 gotchas
global varName(elemName) raises an error nowAlso for upvar 0 x(1) y(1)Was previously an impotent operation that created inaccessible variables
Don’t rely on integer overflow - shouldn’t happenlist properly quotes the # chartcl_precision now defaults to 0Auto-initialize for incr
Previously an undefined var would cause an errorGains semantic parity with append, lappend
![Page 18: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/18.jpg)
Tcl 8.6
Currently in active development8.6a1 development initiated April 20088.6b1 released December 20088.6b2 release ETA October 2010
Release schedule marching towards final8.6.0 targeted for 2011
Over 40 TIPs implemented for 8.6Community driven input
Tcl‘2010, October 2010 in Chicagohttp://www.tcl.tk/community/tcl2010/
![Page 19: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/19.jpg)
Tcl 8.6 OO
Core OO! (TIP#257,#320)Major effort by Donal FellowsFoundational 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 20: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/20.jpg)
Tcl 8.6 highlights
Next version of [incr Tcl] (v4) uses TclOONew non-recursive bytecode engine
Enables coroutines, aka generatorsTcl level coroutines in development
Proper tailcallsLess stack hammeringC API to allow user commands to be restartable
Simplified Tcl prefix matchingC API for option parsing taken from Tk as well
Thread extension to be included with core sourcesOther extensions being considered
![Page 21: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/21.jpg)
Tcl 8.6 features
New binary encode|decode with base64binary is now a namespace ensemble
Ability to cancel script evaluation via interp cancelFind insertion point in sorted list lsearch -bisectAdded tcl_platform(pathSeparator) keyUnicode aware string trim*Grouped sort with lsort -strideAllow lset to extend listslset myList end+1 foo equivalent to lappend myList foo
![Page 22: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/22.jpg)
More 8.6 stuff!
Many commands accept nothing gracefully (TIP#323)Base-2 support in format and scan with %bNew file tempfile ?nameVar? ?template?
Creates tempfile and returns a channelNew try/finally syntaxtry body ?handler...? ?finally script?
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 23: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/23.jpg)
But wait, there’s more!
Zlib compression included with new core zlib command
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
Enhanced chan commandclose can close only read or write sideAnonymous pipes with chan pipeTcl level channel transformations chan push|pop
![Page 24: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/24.jpg)
And on the C side of 8.6
Make Tcl_Interp opaqueNo more interp->result
Use Tcl_GetStringResult(interp) insteadAPI for interp->errorLine
Access to startup scripts from CTcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr)void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName)
Portable Tcl_StatBuf accessTcl_Get*FromStat
![Page 25: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/25.jpg)
Tcl 8.6 TDBC
Standard interface for database connectorsCurrently has drivers for sqlite, mysql, odbc and postgres
Leverages TclOO frameworkpackage 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 26: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/26.jpg)
In summary ...
8.5 is 99% compatible with 8.4 at Tcl levelStable and ready for all task loads
8.6 currently in betaFinal release ETA 2011Lots of new features, with more to comeFurther 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.6Later 8.6 changes may require further updates
![Page 27: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/27.jpg)
Q & A
Twitter: @activestate
![Page 28: ActiveState smooth transitions using tcl 8.5 and upgrading to tcl 8.6](https://reader037.fdocuments.net/reader037/viewer/2022102701/55a689f31a28ab391e8b4891/html5/thumbnails/28.jpg)
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