10 ms·
Is Tcl still a COMPLETELY interpreted language? I heard that they added a JIT compiler somewhat recently. But I'm not sure if there's any kind of "true" compi
by StevePerkins 6y ago
Is Tcl still a COMPLETELY interpreted language?
I heard that they added a JIT compiler somewhat recently. But I'm not sure if there's any kind of "true" compiler (or at least linter?), that can find your basic errors prior to runtime.
I used to dabble a lot with Tcl back in the 1990's and early 2000's. I eventually moved into Lisp to scratch that side-project itch, mostly just because I wanted to find more mistakes at build-time than runtime.
- blacksqr 6y agoTcl switched to a bytecode compiler with version 8.0 about 20 years ago, which delivered significant speedups in execution.
- StevePerkins 6y agoYes, but I thought that was a JIT compiler. For all practical purposes, still an interpreter model from the user perspective. Does it allow for ahead of time compilation to bytecode? With build-time reporting of errors in the source code?
- blacksqr 6y agoIf you mean the wikipedia definition of compiling source code to machine code at runtime, then no. The Tcl interpreter contains a bytecode virtual machine, more along the Java model. Source code is converted to bytecode on the procedure level, not the program level, so there's no program-wide checks for consistency. It's done at runtime. There are some officially unsupported tools built in to the interpreter that let you dump bytecode of compiled procedures and reload it. You'd have to roll your own dumping and loading scripts if you wanted to deliver an entire program using those tools.
- blacksqr 6y agoThere is an AOT Tcl-to LLVM IR compiler in development. https://wiki.tcl-lang.org/page/tclquadcode https://wiki.tcl-lang.org/page/tclquadcode
- auxym 6y agoA few years ago I wrote Tcl occasionally, macros for computer-aided engineering software. As a linter, I used nagelfar (http://nagelfar.sourceforge.net/ http://nagelfar.sourceforge.net/). I had it set-up in vim with Syntastic. From what I remember it worked OK, definitely helped compared to no linting.