47
A History of Tcl in the Browser Oh no, not again! 1 Wednesday, 26 October 11

A History of Tcl in the Browser

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A History of Tcl in the Browser

A History of Tcl in the BrowserOh no, not again!

1Wednesday, 26 October 11

Page 2: A History of Tcl in the Browser

The Motivation• need a scripting language

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

Robert Cailliau - CERN

2Wednesday, 26 October 11

Page 3: A History of Tcl in the Browser

We don’t compileEverything is a stringTypes are for wimpsEschew obsfucation!Speed is overrated

We are the 0.1%3Wednesday, 26 October 11

Page 4: A History of Tcl in the Browser

The Motivation• need our scripting language

- portability

- productivity

- deployment

- relevancy

4Wednesday, 26 October 11

Page 5: A History of Tcl in the Browser

5Wednesday, 26 October 11

Page 6: A History of Tcl in the Browser

The Motivation• Android

- no mainstream Tcl release

- no Tk

• iOS

- Objective C / Javascript only

- Tcl - feasible and practical?

- deployment

6Wednesday, 26 October 11

Page 7: A History of Tcl in the Browser

The Survey

7Wednesday, 26 October 11

Page 8: A History of Tcl in the Browser

1995 - Eolas WebRouser• the first Web Tcl

• one of the first plugins

Browser

WebWish

HTML Tcl/Tk

MEAPI

8Wednesday, 26 October 11

Page 9: A History of Tcl in the Browser

1995 - Eolas WebRouser• the first Web Tcl

• one of the first plugins

Pros • Tcl + Tk • security model • web apps

Cons • plugin • no longer available

9Wednesday, 26 October 11

Page 10: A History of Tcl in the Browser

1996 - The Tcl Plugin• SunLabs Tcl Group

• one of the first Netscape plugins

Browser

Tcl Plugin

HTML Tcl/Tk

NPAPI

10Wednesday, 26 October 11

Page 11: A History of Tcl in the Browser

1996 - The Tcl Plugin• SunLabs Tcl Group

• one of the first Netscape plugins

Pros • Tcl + Tk • Safe-Tcl security • still available FF + IE

Cons • plugin • not on mobile • deployment

11Wednesday, 26 October 11

Page 12: A History of Tcl in the Browser

1998 - Proxy Tk• Java applet + custom server

• efficient client/server protocol

Browser

Java VM

Web Server

TclProxyTkHTML

Tk

Tcl interpeter

12Wednesday, 26 October 11

Page 13: A History of Tcl in the Browser

1998 - Proxy Tk• Java applet + custom server

• efficient protocol

Pros • Tcl + Tk • client / server • deployment

Cons • no offline support • subset of Tk • no longer available

13Wednesday, 26 October 11

Page 14: A History of Tcl in the Browser

2003 - TkWeb• render Tcl/Tk using HTML + CGI

Browser

HTML

Web Server

Tcl/Tk

CGI

14Wednesday, 26 October 11

Page 15: A History of Tcl in the Browser

2003 - TkWeb• render Tcl/Tk using HTML + CGI

Pros • Tcl + Tk • Javascript • no plugin

Cons • experimental • incomplete • no offline support

15Wednesday, 26 October 11

Page 16: A History of Tcl in the Browser

2006 - Æjaks• Tcl in the server (via Jacl)

• Ajax-based windowing system

Browser

JavascriptHTML

Tk

Tcl

Jacl

Echo2

Java VM

Echo2

Web Server

16Wednesday, 26 October 11

Page 17: A History of Tcl in the Browser

2006 - Æjaks• Tcl in the server (via Jacl)

• Ajax-based windowing system

Pros • Tcl + Tk • Javascript • no plugin

Cons • subset of features • no offline support

17Wednesday, 26 October 11

Page 18: A History of Tcl in the Browser

2007 - JsTcl• Tcl interpreter in Javascript

• transliteration of Picol

Browser

JavascriptHTML

Tcl

18Wednesday, 26 October 11

Page 19: A History of Tcl in the Browser

2007 - JsTcl• Tcl interpreter in Javascript

• transliteration of Picol

Pros • Javascript • no plugin

Cons • experimental • incomplete

19Wednesday, 26 October 11

Page 20: A History of Tcl in the Browser

2010 - WubTk• Tcl in server

• Tk over jQuery over Javascript in browser

Web Server

Tcl

Tcl interpeter

Browser

JavascriptHTML

Tk

jQuery

20Wednesday, 26 October 11

Page 21: A History of Tcl in the Browser

2010 - WubTk• Tcl in server

• Tk over jQuery over Javascript in browser

Pros • Tcl + Tk • Javascript • no plugin

Cons • subset of Tk • no client-side Tcl • no offline use

21Wednesday, 26 October 11

Page 22: A History of Tcl in the Browser

2011 - NaTcl• Tcl in Google Native Client (NaCl) sandbox

• real Tcl, native code

Browser

NaCl

HTML

Tcl

NaTcl

22Wednesday, 26 October 11

Page 23: A History of Tcl in the Browser

2011 - NaTcl• Tcl in Google Native Client sandbox

• Tk over jQuery over Javascript in browser

Pros • speed • full Tcl in the browser • interface with the DOM

Cons • no Tk • Google Chrome only • plugin

23Wednesday, 26 October 11

Page 24: A History of Tcl in the Browser

2011 - IncrTcl in Javascript• Tcl in Google Native Client sandbox

• Tk over HTML/CSS/Javascript in browser

Browser

JavascriptHTML

TclTk

24Wednesday, 26 October 11

Page 25: A History of Tcl in the Browser

2011 - IncrTcl in Javascript• Tcl in Google Native Client sandbox

• Tk over jQuery over Javascript in browser

Pros

Cons

25Wednesday, 26 October 11

Page 26: A History of Tcl in the Browser

2011 - NaTk• Tk over jQuery over Javascript

• client-side

26Wednesday, 26 October 11

Page 27: A History of Tcl in the Browser

2011 - NaTk• Tk over jQuery over Javascript

• client-side Tk

Browser

JavascriptHTML

Tk

jQuery

27Wednesday, 26 October 11

Page 28: A History of Tcl in the Browser

2011 - NaTk• Tk over jQuery over Javascript

• client-side Tk

Pros • Javascript • HTML5/CSS3 • offline use

Cons • proof of concept • subset of Tk

28Wednesday, 26 October 11

Page 29: A History of Tcl in the Browser

Summary• several options available

- the Venerable Plugin

- Æjaks

- WubTk

- NaTcl

- incrTcl in Javascript

29Wednesday, 26 October 11

Page 30: A History of Tcl in the Browser

Summary• several options available

• arguably none ready for prime time

30Wednesday, 26 October 11

Page 31: A History of Tcl in the Browser

Oh no, not again!

31Wednesday, 26 October 11

Page 32: A History of Tcl in the Browser

Three approaches• translate application code to Javascript

• implement the TEBC engine in Javascript

• implement Tcl in Javascript

32Wednesday, 26 October 11

Page 33: A History of Tcl in the Browser

Linux in a browser• PC emulator Javascript

• small

• fast

• Linux boots in the browser

33Wednesday, 26 October 11

Page 34: A History of Tcl in the Browser

34Wednesday, 26 October 11

Page 35: A History of Tcl in the Browser

Linux in a browser• PC emulator Javascript

• small

• fast

• Linux boots in the browser

• hand-coded Javascript

35Wednesday, 26 October 11

Page 36: A History of Tcl in the Browser

Emscripten• translate C to Javascript

EmscriptenLLVM JavascriptC Code bitcode

36Wednesday, 26 October 11

Page 37: A History of Tcl in the Browser

Emscripten• translate C to Javascript

• acceptable performance

• other languages + packages ported

• which Tcl codebase?

EmscriptenLLVM JavascriptC Code bitcode

37Wednesday, 26 October 11

Page 38: A History of Tcl in the Browser

Jim Tcl• small footprint

• small codebase

• advanced features

• high degree of compatibility

38Wednesday, 26 October 11

Page 39: A History of Tcl in the Browser

Jim JS• build environment

• invoking Tcl function execute(text) { Module.run(text);}

function print(text) { console.log(text);}

39Wednesday, 26 October 11

Page 40: A History of Tcl in the Browser

Jim JS• build environment

• invoking Tcl

• malloc 0

• missing functions

40Wednesday, 26 October 11

Page 41: A History of Tcl in the Browser

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/Firefox 30

Jim/Safari 27

41Wednesday, 26 October 11

Page 42: A History of Tcl in the Browser

Jim JS• build environment

• invoking Tcl

• malloc 0

• missing functions

• performance

• tactical not strategic solution

42Wednesday, 26 October 11

Page 43: A History of Tcl in the Browser

Deja vu all over again• technoarchaeology ?

• archeotechnophilia ?

• technonecrophilia !

43Wednesday, 26 October 11

Page 44: A History of Tcl in the Browser

44Wednesday, 26 October 11

Page 45: A History of Tcl in the Browser

Demo

45Wednesday, 26 October 11

Page 46: A History of Tcl in the Browser

Where to now?• Tcl - tactical

- Jim JS

• Tcl - strategic

- ubiquity - optimized Javascript

- speed - native or NaTcl

• Tk over HTML5 / CSS3

- desktop + browser

46Wednesday, 26 October 11

Page 47: A History of Tcl in the Browser

Typple anyone?

Typeless Programming Language

typple.net

47Wednesday, 26 October 11