Blog

Exploring Tcl internals from script - Part II

Published , updated

A previous blog post described the representation command and its use for introspecting Tcl's internal structures for storing data. I promised a follow-up post that talked about Tcl's compiled byte code and the disassemble command for inspecting it. Well, only two years later, here is that post as promised.

(read more...)

Exception handling in promises

Published , updated

In a prior post I had illustrated the use of the Tcl promise package for asynchronous computing with some examples. There we had ignored the possibility of errors and exceptions and how they are handled in promise-based code. In this post, we build on the examples in that post to illustrate how promises greatly simplify handling of errors in async code.

(read more...)

Promises by example

Published , updated

I had previously described an experimental implementation of promises for Tcl. On re-reading my earlier post, I was somewhat dissatisfied with the treatment there in that I did not feel it fully reflected the value of the promise abstraction, getting somewhat caught up in the details. This post takes a somewhat different approach, concentrating more on examples and refraining from going into detail about each command or method. Here I am more interested giving you a flavor of programming with promises and motivating you to explore further.

(read more...)

Making promises in Tcl

Published , updated

This post is obsoleted by the promise package (based on the code is this post) and by newer posts on the topic. Nevertheless it may still hold some tutorial benefit.

There is quite a bit of hoopla in the Javascript world around the promise abstraction for asynchronous code. Implemented in various forms in third party libraries, it proved sufficiently useful to be formally defined and incorporated into ECMAScript 6.

Other languages, from Python and Scala to C#, C++ and Java, have implementations of promises in various flavors (sometimes separated into promises and futures). Not finding one for Tcl (we cannot let Tcl lag!), I started on an experimental implementation described in this post.

(read more...)

Exploring Tcl internals from script - Part I

Published , updated

Tcl has some commands that are undocumented because they are liable to change, or even be removed, at any time, even in a patch release. Nevertheless, these commands can be very useful in exploring and understanding the inner workings of Tcl and in some cases, dealing with issues related to performance or interaction with external systems like COM on Windows.

(read more...)

Introduction to Tcl Database Connectivity

Published , updated

Tcl 8.6 shipped with the Tcl Database Connectivity (TDBC) API for accessing disparate SQL database implementations in a standard manner. I happened to need it for the first time recently and collected my notes into an introductory article for the benefit of those who, like me, prefer to be spoon fed.

(read more...)

Hotkeys on Demand

Published , updated

There is no shortage of hotkey programs for Windows, many of them of high quality. And of course Windows itself allows you to define hotkeys. However, a hotkey program in Tcl is not only very simple to write, it offers the full flexibility and power of Tcl behind it. Meaning what exactly? Read on.

(read more...)

Playing God on Windows

Published , updated

There are times during software development when you want to run in interactive mode with maximum privileges on a system, be God as it were. One might think running as Administrator would do it but it doesn't. To be truly omnipotent on Windows, you have to run under the LocalSystem account[1]. It is easy enough with Tcl and this post shows you how. As a side bonus, it also describes how to inject processes into the interactive user's desktop to run under the user's account as well.

(read more...)

How do I exec thee? Let me count the ways...

Published , updated

One of the strengths of Tcl is the ease of integration with other software, whether they be COM components, libraries or even executable programs that are not designed for interaction with other programs. Here we look the facilities Tcl offers related to the last of these -- running external programs and optionally interacting with them using standard I/O mechanisms.

(read more...)

Building OpenSSL and TLS on Windows

Published , updated

This post may be partially, or even completely, out of date. Both OpenSSL and the TLS extension have had major updates since it was written.

Building the Tcl TLS extension on Unix/Linux is straightforward because OpenSSL libraries are already present and installed. It's a different matter on Windows where you need to build OpenSSL yourself. This short article describes the process.

(read more...)