Re: Tcl bytecode



Googie wrote:
suchenwi wrote:
With TclDevKit ($$) you can save bytecodes to a file (and load them with tbcload). However, their purpose is to obfuscate code, and loading them is slower than parsing genuine Tcl source files :)
For open source, I find it most suitable that scripts are openly readable, and editable in case of problems.


But TDK does translation to _some_ bytecode which isn't the same bytecode which Tcl interpreter executes (if I understeand correctly TDK compiler idea, of course).

No, it actually uses the same bytecodes. However, TDK has to make the bytecode portable (no BE vs. LE issues allowed), so that is part of the extra translation that doesn't make this loader faster.

I mean to save Tcl bytecode as it's represented just after byte-compilation - when script is loaded into interpreter.
Why write external tools to do such a thing, when Tcl Core (interpreter) already (while script execution) has such a bytecode in memory?

One main reason that this hasn't been an issue is that there isn't a huge overhead to compiling. Other languages have more compile overhead, so it makes more sense there to precompile. Perl for example likes to do a full syntax parse, even over code areas that won't be used. Tcl is much lazier - it only compiles procs as it first executes them. This distributes any compile overhead over the runtime of the application.

--

Jeff Hobbs, The Tcl Guy, http://www.activestate.com/
.



Relevant Pages

  • Re: building a starkit of Img?
    ... Because if I use my system Tcl, some things are going to be different, ... compile stuff, so that that ... Not yet:-) I'm actually trying to just do an Img starkit, ... > truly simple, quick, and robust installs are acceptable. ...
    (comp.lang.tcl)
  • Re: CEPTCL: Doesnt RX multicast, has anyone seen it work before?
    ... on my Linux. ... gave me are set up to compile for windows. ... has all of the files and the makefile is set up for Linux too. ... please modify the Makefile for proper Tcl path. ...
    (comp.lang.tcl)
  • Re: convert tcl in a standalone application thanks to MinGw
    ... already many proposed solution, I didn't find the right solution. ... I found it cool to combine C and tcl. ... you only have to compile your c extension and any C compiler may ... set rootdir $starkit::topdir ...
    (comp.lang.tcl)
  • Re: tcl upgrade on redhat 5.2
    ... I ran "make" and the tcl compile went ... switch as I did with the tcl. ... Must I be in XWindows to compile TK? ...
    (comp.lang.tcl)
  • cannot link dll : undefined reference to `tclStubsPtr
    ... I am trying to build a dll for windows from a linux platform using ... The dll is a package extension for tcl. ... I first compile supporting ".o"s without any special flags (they don't ... `tclStubsPtr' ...
    (comp.lang.tcl)