Larry McVoy's Love/Hate relationship with Tcl gives birth to L
Larry McVoy gave the first afternoon talk. I missed the first couple of minutes of the beginning of it. Again, here are my notes:
Why not use someone elses $SCRIPTING_LANGUAGE. None can be extended from C as easily as Tcl. "Python is the obvious choice but has crappy bindings to Tk." Java slow startup [and something else I didn't write down in time]. Says he tried to convince Sun originally to make Tk be the GUI for Java.
Why not pure Tcl? No C-like structs in Tcl. Associative arrays don't count. No lint like tools in Tcl (dynamic languages make that impossible to get 100% right) No type checking. Optimizing Tcl is harder than L (L is a "weaker" language, easier to optimize).
Why not C & native GUIs? No need to assemble a Tk + Title + ... + distro. GUI functionality—it's still hard to beat the canvas and text widgets. Development costs are at least 6x higher (3x engineering cost, 3x QA cost) for native code. They target a lot of platforms: Windows, MacOS, X11, and maybe java. More variations == more support costs. Goal of BitMover is to drive the company to where they need zero support.
Basic types: int, float, string like C (mostly). variable interpolation requires ${foo} or really just any L expression ${1+2}. :magic_constants such as: text(".t", :bg, "white", :fg, "black");
Locals get initialized to zero, the empty string, whatever is appropriate. Strings are first class objects. No character type ("we are unicode, what the hell is the length of a character?")
Associate arrays (swiped Perl syntax for initializing them). Keys and values are string. Tcl dicts under the covers.
C like arrays (int v[]). They look like C but don't need specified size. They autogrow on assignment.
Structs: currently like C but may get initializers. Tcl lists under the covers. Structure fields are in "::L::struct eg" (for introspection).
Pass by value as expected like Tcl & C.
By reference: automatic for hashes and arrays. Needs & for other types. Implemented as syntactic sugar using upvar. L pointers used where upvar won't work.
New Tcl Object:
struct pointer { int depth; //upvar #depth string name; //tcl var pointed to string index; // optional index };
Used in places like: checkbutton(".f.v1", :variable, &foo.v);
Control flow: Usual C stuff plus, perl regex statements, iterating over hashes. Some minor sugar: unless {expr} stmt; until {expr} stmt;
Switches cases may be constats, regexps, or globs.
loops for hashes. iterating over an array of whatever. Looking for a better syntax than: foreach (h as key => val) {...}
Top-level compilation. Because there is no L interpreter path.
Changes to the Tcl Parser. #lang(tcl), #lang(L) to switch languages. If filename is not .L (.l ?) then assume Tcl mode. When you see #lang(L), grabs until eof or #lang(tcl) and feeds it to L. Don't need to match curly braces.
Left to do: Type checking isn't done; They haven't written substantial programs in it; Plan to rewrite their [BitMover's] GUIs in L; Check back next year...
Future work: scoping, pre-compiled modules, optimizations, debugging, dynamic type checking.
Last slide: L@bitmover.com. Apparently they have a Wiki somewhere, but it only has one page at the moment, and they didn't mention what the URL was.
Gerald Lester asked about: foreach i in v { ... }. Unless Larry has studied that carefully will he remember that i is an index value or a value.
Richard Hipp: So does the name of the language stand for Larry? Larry: It doesn't stand for "Loser". Earlier names: LORD (Larry Oscar Richard D____), HINT (Hint Is Not Tcl). Open to suggestions.
License is Tcl license, no strings attached.
Guiding principles: if we can't compelling use case we just don't. (Larry has to be able to understand it.) Slammed C++ here (wish I'd got it word for word—very inflammably quotable ;-)
Gerald: You didn't mention catch or anything like it; do you guys just not need it because you don't make errors? Larry: need some experience first. Pointed out that anything that is a Tcl procedure [command] can be called by L, so can use [catch].
—Michael A. Cleverly
Wednesday, October 11, 2006 at 14:04
"Python is the obvious choice but has crappy bindings to Tk."
Yeah, it uses Tcl for the glue layer. Tcl? How crappy.
Wed, 11 Oct 2006, 16:17