Landon Fuller | 12 Oct 2002 18:35
Picon
Favicon

Re: Why TCL?

On Wednesday, Oct 9, 2002, at 11:46 US/Pacific, Bram Moolenaar wrote:

> 	Why use TCL?
>
> I'm not criticizing the choice, I would just like to know why it was
> considered a better choice than Python, Perl or whatever.  No need to
> explain why it's better than Makefiles, I can understand that.
>

Took me a few days, but here's a reasonable answer =)

Initially, I looked at XML description files. While XML is highly 
parsable, it illustrated a key design difficulty. A description file is 
not only a list of key value pairs, but an assembly of data and 
intertwined operations on that data. XML is not well suited to concepts 
such as variable substitution, or inline modification of the XML tree. 
To solve this, XML description files could be run through m4, a 
scripting language could be inlined within the XML, or perhaps a 
scripting language with inlined XML. None of these solutions are 
attractive.

TCL is well suited to this problem. Its syntax allows for highly 
readable key/value pairs in the simple case, and the parser is 
lightweight and straightforward. The key/value pairs are created by 
generating procedures for every option at runtime. By running the 
description files through a TCL interpreter, a description file has 
complete to TCL and the ports system.

Also, TCL has support for a very powerful library versioning system. By 
leveraging this, I can tie portfiles to specific revisions, or ranges 
of revisions, of the ports system. This facilitates backwards 
compatibility when revising the entire system.

After much evaluation, I decided that TCL offered the best environment 
for handling both the simple and complex case. The language is just 
well suited to the problem, allowing simple, powerful, and readable 
description files.

Also, I've described the entire system in more detail at 
http://ezine.daemonnews.org/200210/darwinports.html

cheers,
-landon


Gmane