A History of Tcl in the Browser Oh no, not again!

Wednesday, 26 October 11 1 The Motivation

• need a scripting language

Anyway I know only one programming language worse than and that is Javascript ....the most horrible kluge in the history of computing Robert Cailliau - CERN

Wednesday, 26 October 11 2 We don’t compile Everything is a string Types are for wimps Eschew obsfucation! Speed is overrated We are the 0.1%

Wednesday, 26 October 11 3 The Motivation

• need our scripting language - portability - productivity - deployment - relevancy

Wednesday, 26 October 11 4 Wednesday, 26 October 11 5 The Motivation

• Android - no mainstream Tcl release - no Tk • iOS - Objective C / Javascript only - Tcl - feasible and practical? - deployment

Wednesday, 26 October 11 6 The Survey

Wednesday, 26 October 11 7 1995 - Eolas WebRouser

• the first Web Tcl • one of the first plugins

HTML Tcl/Tk

WebWish MEAPI

Browser

Wednesday, 26 October 11 8 1995 - Eolas WebRouser

• the first Web Tcl • one of the first plugins

Pros Cons • Tcl + Tk • plugin • security model • no longer available • web apps

Wednesday, 26 October 11 9 1996 - The Tcl Plugin

• SunLabs Tcl Group • one of the first Netscape plugins

HTML Tcl/Tk

Tcl Plugin NPAPI

Browser

Wednesday, 26 October 11 10 1996 - The Tcl Plugin

• SunLabs Tcl Group • one of the first Netscape plugins

Pros Cons • Tcl + Tk • plugin • Safe-Tcl security • not on mobile • still available FF + IE • deployment

Wednesday, 26 October 11 11 1998 - Proxy Tk

• Java applet + custom server • efficient client/server protocol

Tk

HTML ProxyTk Tcl

Java VM Tcl interpeter

Browser Web Server

Wednesday, 26 October 11 12 1998 - Proxy Tk

• Java applet + custom server • efficient protocol

Pros Cons • Tcl + Tk • no offline support • client / server • subset of Tk • deployment • no longer available

Wednesday, 26 October 11 13 2003 - TkWeb

• render Tcl/Tk using HTML + CGI

HTML Tcl/Tk

CGI

Browser Web Server

Wednesday, 26 October 11 14 2003 - TkWeb

• render Tcl/Tk using HTML + CGI

Pros Cons • Tcl + Tk • experimental • Javascript • incomplete • no plugin • no offline support

Wednesday, 26 October 11 15 2006 - Æjaks

• Tcl in the server (via Jacl) • -based windowing system

Tk

Echo2 Tcl

HTML Javascript Echo2 Jacl

Java VM

Browser Web Server

Wednesday, 26 October 11 16 2006 - Æjaks

• Tcl in the server (via Jacl) • Ajax-based windowing system

Pros Cons • Tcl + Tk • subset of features • Javascript • no offline support • no plugin

Wednesday, 26 October 11 17 2007 - JsTcl

• Tcl interpreter in Javascript • transliteration of Picol

Tcl

HTML Javascript

Browser

Wednesday, 26 October 11 18 2007 - JsTcl

• Tcl interpreter in Javascript • transliteration of Picol

Pros Cons • Javascript • experimental • no plugin • incomplete

Wednesday, 26 October 11 19 2010 - WubTk

• Tcl in server • Tk over jQuery over Javascript in browser

Tk

jQuery

HTML Javascript Tcl

Tcl interpeter

Browser Web Server

Wednesday, 26 October 11 20 2010 - WubTk

• Tcl in server • Tk over jQuery over Javascript in browser

Pros Cons • Tcl + Tk • subset of Tk • Javascript • no client-side Tcl • no plugin • no offline use

Wednesday, 26 October 11 21 2011 - NaTcl

• Tcl in Native Client (NaCl) sandbox • real Tcl, native code

Tcl

HTML NaTcl

NaCl

Browser

Wednesday, 26 October 11 22 2011 - NaTcl

• Tcl in Google Native Client sandbox • Tk over jQuery over Javascript in browser

Pros Cons • speed • no Tk • full Tcl in the browser • only • interface with the DOM • plugin

Wednesday, 26 October 11 23 2011 - IncrTcl in Javascript

• Tcl in Google Native Client sandbox • Tk over HTML/CSS/Javascript in browser

Tk Tcl

HTML Javascript

Browser

Wednesday, 26 October 11 24 2011 - IncrTcl in Javascript

• Tcl in Google Native Client sandbox • Tk over jQuery over Javascript in browser

Pros Cons

Wednesday, 26 October 11 25 2011 - NaTk

• Tk over jQuery over Javascript • client-side

Wednesday, 26 October 11 26 2011 - NaTk

• Tk over jQuery over Javascript • client-side Tk

Tk

jQuery

HTML Javascript

Browser

Wednesday, 26 October 11 27 2011 - NaTk

• Tk over jQuery over Javascript • client-side Tk

Pros Cons • Javascript • proof of concept • HTML5/CSS3 • subset of Tk • offline use

Wednesday, 26 October 11 28 Summary

• several options available - the Venerable Plugin - Æjaks - WubTk - NaTcl - incrTcl in Javascript

Wednesday, 26 October 11 29 Summary

• several options available • arguably none ready for prime time

Wednesday, 26 October 11 30 Oh no, not again!

Wednesday, 26 October 11 31 Three approaches

• translate application code to Javascript • implement the TEBC engine in Javascript • implement Tcl in Javascript

Wednesday, 26 October 11 32 in a browser

• PC emulator Javascript • small • fast • Linux boots in the browser

Wednesday, 26 October 11 33 Wednesday, 26 October 11 34 Linux in a browser

• PC emulator Javascript • small • fast • Linux boots in the browser • hand-coded Javascript

Wednesday, 26 October 11 35

• translate C to Javascript

C Code LLVM bitcode Emscripten Javascript

Wednesday, 26 October 11 36 Emscripten

• translate C to Javascript

C Code LLVM bitcode Emscripten Javascript

• acceptable performance • other languages + packages ported • which Tcl codebase?

Wednesday, 26 October 11 37 Jim Tcl

• small footprint • small codebase • advanced features • high degree of compatibility

Wednesday, 26 October 11 38 Jim JS

• build environment • invoking Tcl function execute(text) { Module.run(text); } function print(text) { console.log(text); }

Wednesday, 26 October 11 39 Jim JS

• build environment • invoking Tcl • malloc 0 • missing functions

Wednesday, 26 October 11 40 Jim JS

• build environment • invoking Tcl • malloc 0 • missing functions • performance time {set a 10; set b $a} ActiveTcl 8.6b1.2 0.43 Jim/ 30 Jim/Safari 27

Wednesday, 26 October 11 41 Jim JS

• build environment • invoking Tcl • malloc 0 • missing functions • performance • tactical not strategic solution

Wednesday, 26 October 11 42 Deja vu all over again

• technoarchaeology ? • archeotechnophilia ? • technonecrophilia !

Wednesday, 26 October 11 43 Wednesday, 26 October 11 44 Demo

Wednesday, 26 October 11 45 Where to now?

• Tcl - tactical - Jim JS • Tcl - strategic - ubiquity - optimized Javascript - speed - native or NaTcl • Tk over HTML5 / CSS3 - desktop + browser

Wednesday, 26 October 11 46 Typple anyone?

Typeless Programming Language typple.net

Wednesday, 26 October 11 47