Version 1 of Eagle: Re-implementing Tcl in C#

Updated 2008-10-22 19:11:48 by mistachkin

MC's notes on Joe Mistachkin's Tcl2008 talk regarding his re-implementation of Tcl in C#.

JJM -- The full paper and slides will also be available (soon) from the project web site.

(I missed the first slide...)

Notable features:

  • Integrates with Microsoft's Common Language Runtime (CLR), Tcl/Tk, native libraries
  • Supports interactive debugging, script cancellation; read-only variables, commands; interpreter-wide variable tracing; closures; Unicode (UCS-2)

Missing:

  • No Tk commands
  • No argument expansion syntax
  • No namespace support (yet)
  • No binary, fblocked, fcopy, fileevent, format, glob, history, memory, can or trace commands
  • No registry or DDE commands
  • No asynchronous input/output
  • No server sockets
  • No slave interpreters, hidden commands, aliases, hence no Safe Tcl
  • No http, msgcat, or tcltest packages
  • For the open command, command pipelines and serial ports are not yet supported
  • For the exec command, Unix-style input/output redirection and command pipelines are not supported

Compiles with Visual Studio 2005, 2008 and/or .NET framework compiler. Ran a demo eagle console. "#show" special command to show output helpful for debugging

 % set x [[object create System.Int32]]
 System#Int32#216
 % object invoke $x ToString
 0
 % set y [[object create -alias System.Int32]]
 ...

Eagle, being managed code, has access to all the .NET framework. Joe ran a demo that used .NET calls to instantiate a Windows form.

Within Eagle: [tcl find] finds installed versions of Tcl. [tcl load] can load them. Eagle can load Tcl via a .dll; then package require Tk. Thus Tk and winforms can be mixed.

Calling foreign functions:

 set z [[library declare -functionname GetUserNameA -returntype Boolean -paramatertypes [[list intptr uint32&]] -charset ansi -module ...]]

Eagle takes a different approach to some things than Tcl. Semantically compatible at the script level. Radically different underneath the hood. No interp->result. Interpreters in Eagle have no thread affinity; can be used from any thread.

Question from the chat: "How easy is it to embed Eagle into a C# application?" Answer: examples of doing that come with the distribution. Walked through a simple example.

Question: What is the benefit of rewriting versus wrapping? Answer: Requirement was to implement the scripting language totally in 100% managed mode code.

Downloadable from http://eagle.to