 Thank you. Sorry about the wine there, I don't know what's going on. I'm going to talk about TCL as a minimalist language in the sense that as a language it sort of has no syntax, not no syntax but no keywords and a minimalist syntax that lets you inject your own commands and in fact the things that ship out of the box are the same sorts of commands that you can make yourself and so you can make it be whatever you need to be and this is the long lever with an easy grip because you can make it feel however you like and then do whatever you want. So I've got no slides to show, I've got some demonstrations to show. I'll talk briefly a little bit about the history of it and then get into a couple of the features and specifically get into tweaking some of those features to show what you can do with it. First of all, I guess how many people are already familiar with TCL as a language? Small, maybe less than half. How many people program with the C API? Two? Three? Okay, so we're going to get into some C, just a heads up but it's good, it's fun. First of all, so TCL was started, was launched onto the world in about 1987 and what brought it there was the inventor's frustration working with command languages leading up to that. So what he did was design integrated circuits and built tooling for the work for the integrated circuit work and they had specific tools that they wanted to build and commands to drive their tools and every time that they were doing their work, ad hoc, they would build the control languages that they want and end up building something that was slightly different time after time incompatible time after time in ad hoc from time to time. On sabbatical from his work at the UC Berkeley, it occurred to him why not write a standard kind of a thing to do this that would be a simple kind of a shim that you can inject into whatever the tool, the specific work, the things that they're interested in and have a standard library that would do that. At the time this was before the wide distribution of GUIs as far as tools go so people were typing all of their commands and this was the conception of TCL. It was launched on the world in 1988, so it developed conceptually in 87 and launched in 88 so at about this time Pearl 1 was out Python, I think still had about six years to come, Ruby was still in the future, Bash was in the future, so often I think that TCL is lumped in with languages as a scripting language which is fair, it's interactive, it's got a redevelop print loop, it's got the quick sort of prototyping I guess that people associate with a scripting language so you could say Ruby, Pearl, Python, TCL as far as languages but it is unique in the sense that it doesn't have any keywords and it's built to be injected into a thing that is more interesting than what it is and then it provides kind of a substrate to have the interesting thing that you're working on put commands into it and then make them available. So for example what it would do is give you things like looping constructs and decision and variable assignment and simple things like that so you can have a tool that does an interesting thing and leave driving that tool to something else, this is all very abstract but we'll, that's not that abstract but we'll get into some specific examples later on. One of the things that is interesting about TCL is that it's what's called homo-iconic which means that the icon is the representation of what it works with which is to say that in this case code is data or data is code, you'll be familiar with this from lists for example where it runs as lists and it parses lists and so we can emit a thing and run that thing. TCL is the same way but it uses strings, indeed it used to be pure string run as a language so it would be shooting strings or arrays of characters around as the method of its operation that's different now but conceptually it's the same thing, everything is representable as a string. So what that means is that commands emit strings and strings are the things that you run so you can have the emitted part of a command as a runnable thing. The commands are also, I was thinking about it in the sense that it's kind of like a socket pair in the sense to try and figure out what a command is where with a socket for example you've got an IP and you've got a port or a pair, another IP and another port and that is a unique identifier between two machines and there's no other thing that is like that as well. With the commands they have a name but they also have a little piece of data that comes along with them. They also have an implementation that could be separate from the name and in this sense it's almost like the Magritte painting, Sisi, Nepas and Pip where you might wonder what it's doing or what's going on and indeed you can take the standard commands and rename them or delete them because there are no keywords in TCL so it is a substrate that runs a thing and that's it. So it provides a substrate, it ships a bunch of commands but you don't need to use them and indeed a lot of people rewrite them. Example, looping structures, you have wiles and fours or four each to run across a list and it does the obvious thing. You can say 4x in list of things, do some stuff and it will properly do those things, iterate over it but I've written things for example that would take a JSON blob as a command and iterate over all of the pure nodes or recourse down the children nodes as a looping structure. So the JSON parser you can take any minimal C version of it and quickly write a nice little interface to TCL for it and turn it into a first class looping kind of a thing within TCL because what a command in TCL is really, really basic. What I'll do I think is launch a couple of demos and so I'll show you some loops and command invocations and we can show some substitution as well how a command can have its output be another command and run that and rewrite some looping and do a little bit of introspection as well which is another good thing as simple as what the substrate for TCL is. It has really great facilities for introspection which is to say you can tell you what it knows and as far as commands go for example and within each command you can say of what type are you which may sound interesting because TCL is often one of its mantras is everything is a string which means that it parses strings and it emits strings. Strings are generally considered type-less and duck typing for example where you just instantiate a variable and have it do the right thing or do something I guess is both attractive and can also be a cause for consternation or outright errors for example if you're trying to work with something as an integer and you feed it something that's not an integer and internally interestingly I think we might touch on it there definitely are types in TCL but everything is still representable as a string so it's the kind of default marshalling method maybe I should have left that off. Method so the strings come and go there are inferences that you can make with the types as well but let me load up some code and show off some of this type stuff that I was talking about so what I've got here is some C code I've got 400 lines 425 lines and this I'm going to load into a default TCL interpreter which I can launch like this and for example with the introspection I can do something like this and get a list of the things that it knows these are the things that ship out of the box so it's tell, socket, subs to open etc etc the code that I've got over here I can load that up as a module and what that looks like is package require and I call this one number like because I was working with some numerical stuff as an initial example so this module is loaded now and if I go back over here what I've got is a command that's called number like and then 1 so this is my own registered command and somewhere in that list it's going to show up what does it do though it is identity I've got another one that is the same and what is interesting about this is that from here this is the prototype and this is the actual code for it this is the one command is registered here I've got two sub commands that it will take and this is like I said TCL doesn't have any keywords it's got a few simple parsing rules I won't get into them there are 12 of them once you know those 12 you know everything that there is to know so I've got a sub command here that will do add and delete it tells you what it wants it does the obvious thing these are also composable so what I can do is this 3 gets returned as a thing but I could say number like 2 add number like 1 add 3 oops number like 2 add and it does the right thing I'm going to do this and load up something else I've got with respect to the introspection this series of commands here make 1 x, y, z, and a lets you instead of having c code to make a command what I've got is a command that makes commands so this one was called make 1 so this right here takes an argument and takes two arguments actually it takes the name of whatever you want to give it and a base value this is another number emitting kind of a thing and it will create the command right here and it gets injected into the interpreter and it's instantly a first class kind of an object so here I can make four of them and what I'm going to do actually is edit this a bit so you can see here there are the commands that we just created here x, y, and z but aside from that with the commands they let themselves be introspected as well so I know from a command what it's backing c structure or c code is and that is the signature of the c function that it gets called with and I can also determine what a specific piece of client data like discrete specific information belongs with each command so for example if I've got a thing that emits a number the number that it is emitting is going to be carried with it in memory and between with those two different things the backing function and the unique client data that it has I can identify things that are of a type so example I've got a command called like me and what it does is loads it takes two arguments it takes a reference command and a list of candidate commands which are the things that it wants to compare is anything in this list the same as the first reference piece so if I run it I've made commands here that are x, y, z, and a there of a class of commands that just emit numbers if I run like me and I see which things are like x x, y, z, and a are all of the same kind of command so they're all like x and I run that against info commands which is a list of everything that the interpreter knows about what it does is properly identifies what those commands are you might notice that x itself is missing and that is the case right here with the commands there's information that is associated with the commands and I test to see is the backing procedure for any command that we're testing in the list the same as what the reference command is if it is we're going to move on and do some more testing here we're going to filter out other commands so we're going to say if the object data the special piece of memory that's associated with the command is not the same as what we're testing against then that means that it's not the exact same command because if the special memory is the same between the reference command and the one that's in the candidate list that means that the special command is in the candidate list and we don't need to say that it's like itself so if it's not the same then we go and append the element from the list that we're testing because it passed two tests it's the same kind of thing but it's got a different memory so this is just an example of the commands sitting on the substrate and sure yeah, no, that's got it we've let's show it pretty quickly but yeah, are there any questions, comments? practically speaking it's often hidden in enterprise networks it's often buried in F5s and A10 network edge appliances it's used with storage companies as well 3PAR and Hewlett Packard use it for their work in the industry it's also used with computing design so cadence and mentor graphics for example everything that's in your computer has been touched by TCL with electronic CAD often used in prototyping as well and the joke is that it's easy to prototype so things often get whipped up in TCL and then work well enough that they just get rolled into production as well so it also drove the orc army and the lord of the rings so if you enjoyed that you enjoyed TCL yes I do and the way that I came to it to begin with was as the question is whether or not I enjoy writing things in TCL I think it's fine it starts out I find it very legible and then I think that the worry is that it's going to be like using duplo blocks or crayons later on because it seems so easy to use that you're going to outgrow it but the good thing about the malleability of it is that you can extend it as you feel fit and I came to it out of pearl which is pearl and so very strict full of special sigils and variables and things like that that are you have to know some of the deeper inner workings and I find that TCL is enough of a blank slate with a few rules that once you know those it doesn't get in your way at all but it's sufficiently malleable that it's interesting I've used it to do system administration for hundreds or thousands of machines at a time to do network connections and pull databases and turn those things into commands and make it do something interesting thank you very much Brad