Updated 2009-09-08 13:02:29 by LV

What: tclcsharp
 Where: http://sourceforge.net/projects/tclcsharp
 Description: Tcl/CSharp is an implementation of a Tcl interpreter
        written entirely in C#.
        Tcl/CSharp was ported from Jacl (Tcl Java implementation)
        in version 1.3.1
        It offers a bridge to .NET Framework for Tcl code.
 Updated: 12/2004

Contact: Artur Trzewik

See also: Jacl Jacl.NET .NET C#

Some code examples that show where tclcsharp can be valuable:
 # example how to use .NET Framework for accessing web

  package require java
  java::load -gac System.dll
  set webclient [java::new System.Net.WebClient]
  # it can be used also with https
  set bytearr [$webclient DownloadData http://www.google.de]
  puts [[java::call System.Text.Encoding get_UTF8] GetString $bytearr]

 # example how to use .NET Framework for doing XML per DOM

  package require java
  java::load -gac System.Xml.dll
  set doc [java::new System.Xml.XmlDocument]
  set node [$doc CreateElement tclsharp]
  $doc AppendChild $node
  $node AppendChild [$doc CreateTextNode "is usable for many things"]
  puts [[$doc get_DocumentElement] get_OuterXml]

 # accessing operation system. here listing all processes

  package require java
  java::load -gac System.dll
  set procs [java::call System.Diagnostics.Process GetProcesses]
  for {set x 0} {$x<[$procs length]} {incr x} {
     set proc [$procs get $x]
     puts [format "%4s %15s %2s %20s" [java::prop $proc Id] \
          [java::prop $proc ProcessName] [java::prop $proc BasePriority] \
          [java::prop $proc MainWindowTitle]]
  }

Some performance comparation for 3 Tcl-Interpreters (c, java and c#) maked with tclbench (part of tcllib). Testmachine: Intel Pentium 1.6 GHz 256 MByte RAM

Tcl - active state distribution 8.4.3 Jacl 1.2.6 with SUN Java 1.4.3 Tclsharp with .NET 1.1
                Tcl(ms)  Java(ms) Java-scaled  C#(ms)   C#-scaled  C#/Java
   list           92154    791301      8,58    582050      6,31      0,73
   catch             46       875     19,02      1732     37,65      1,97
   condit            99     13795    139,34     14004    141,45      1,01
   data            3682    290110     78,79    142061     38,58      0,48
   eval            4056     12353      3,04      8493      2,09      0,68
   expr             132      9233     69,94      8788     66,57      0,95
   heapsort        9696    975654    100,62    324873      33,5      0,33
   loops           4168    740282    177,61    383107     91,91      0,51
   proc             600     14593     24,32     19775     32,95      1,35
   trace             35       517     14,77       624     17,82       1,2
   unset             36       860     23,88       793     22,02      0,92
   vars             248     24673     99,48     10603     42,75      0,42
   split          19845    341477      17,2    460970     23,22      1,34

It looks not so good for java and c# but one must consider that the tclbench was developed to compare different tcl versions of C-coded Interpreter and the examples was not real life tcl programms. Many expensive algorithms needed for example for xml, crypto, networking can be done by using .NET framework.