
How I Recovered Millions of Transactions Using Tcl (2016) - gglitch
https://www.activestate.com/blog/2016/08/tcl-big-data-how-i-recovered-millions-transactions-using-tcl
======
chris_wot
Not TCL, but my Perl war story was I worked for a printer company. They had
somehow gotten someone to record ink cartridge information into external data
files. INI files to be precise, one INI per record.

They were literally spending 9 weeks opening about 15,000 INI files and
pasting them into an Excel spreadsheet manually.

I was rather silly and made the claim that Perl was designed for this sort of
thing, they challenged me and I felt my honour was at stake, so I whipped up a
program to do it for them one night and brought it in the next day. I ran it
on the INI files, and in about 20 seconds it had put all the data into a CSV
file.

They were astounded that I had taken 9 weeks of tedious, error prone data
entry and processed it in less than a minute. I just figured it was an
interesting thing to do, and told them to keep it quiet as this was really
outside my area, but they made me employee of the quarter anyway.

~~~
tragomaskhalos
This is the curse of Windows - non-technical users assume that everything you
can do with a computer _must_ be done via the UI.

This is perhaps not surprising - in the name of "ease of use" Windows works
very hard to shoehorn you down the point and click route.

~~~
snaky
Visual is more natural, simple and rich way of cognition for human brain than
symbolic expressions, there's nothing wrong with it. What's somewhat pity is
the fact all the attempts to create any 'visual programming' tools failed
miserably. Although we could easily imagine a tool that allows to point a
field in any formatted text like INI file, and point the column in Excel where
the values should be inserted, and automatically build the regular expression
to parse the bunch of such files - that's not visual programming in any way of
course, but if such a tool could be extensible enough, and extensible by the
same visual way, I don't know but maybe some significant part of users should
be interested enough.

------
rauhl
TCL is pretty awesome. I hadn’t used it since the late 90s, but in a recent
project I ended up integrating it into a Go project we’re building, and it was
_great_. Extraordinarily easy to do, and very powerful.

I really need to write a blog entry about it. It’s now a valuable tool in my
toolbox.

------
bitwize
Tcl is bananas. On the one hand, its approach to structuring data (cram
everything into strings, including procedures!) is... idiosyncratic and not
what I'm used to. On the other, it seems to work hand in glove with the "Unix
Way" (for whatever that's worth), and I've never seen a faster way to get a
GUI up and running than Tcl/Tk. Not Visual Basic. Not even Smalltalk.

~~~
ofrzeta
It's a bit idiosyncratic for sure. For one I always thought why the hell would
you design a language and not use "=" as an assignment operator. On the other
hand it's not a good reason to reject a programming language when it has a lot
of other good features.

~~~
ken
> why the hell would you design a language and not use "=" as an assignment
> operator

That's one of my favorite things about Tcl. It just makes so much sense.
Testing equality is analogous to testing inequality. It's a complex and
context-dependent operation. Binding a value to a symbol is a completely
different type of operation, and there's no reason for it to look similar.
Keeping arithmetic in its own little space makes everything else so much
simpler.

Many of the most interesting new languages I've seen which don't come from the
C/Unix school use something different for assignment, e.g., Factor (Forth),
Clojure (Lisp), etc.

~~~
tragomaskhalos
Nor is it just the new kids - ":=" for assignment goes back to Pascal and
Smalltalk (IIRC Smalltalk used a funky left arrow, like R but a single char,
but also allowed := because who has a funky left arrow on their keyboard?)

------
ericfrederich
Python is a great way to run Tcl ;-) Seriously though, Python's Tcl bindings
are done at the C level and provide great interoperability.

At a previous job I utilized these low level bindings to create higher level
bindings. Used reflection of both Python and Tcl to expose themselves to each
other. Was able to seamlessly use Tcl objects from Python and vice versa.

~~~
gglitch
While browsing a Ruby codebase’s config.rb recently, I saw several proc
commands followed by bracketed subcommands and wondered if it was for some
reason Tcl embedded into a Ruby script. Could that be an example of what
you’re describing here? What’s the use case for that?

~~~
dragonwriter
> While browsing a Ruby codebase’s config.rb recently, I saw several proc
> commands followed by bracketed subcommands and wondered if it was for some
> reason Tcl embedded into a Ruby script

The proc method in Ruby takes a Ruby block, which is delineated either by
brackets or do...end. it has nothing to do with embedding Tcl.

------
ofrzeta
The article says "Tcl’s innate asynchronicity". Does anybody who knows Tcl
care to tell more about this?

~~~
blacksqr
Tcl has built-in event loop functionality. You can put watches on file
channels, network sockets or synthetic scripted channels, start the event
loop, and have a completely event-driven program.

Writing a simple web server, for example, is trivial.

Tk accesses the C-based event API to turn things like button clicks into
events. Python (and Ruby?) ships with Tcl in order to make use of Tk.

There's a thread extension that makes it easy to spawn separate threads which
can inject events into the event loop, making hybrid event/thread programming
simple.

~~~
a_lieb
This is right. It's "innately async" in the same way as Node: there is a built
in event loop, and just about anything that could block (file I/O, GUI input,
etc.) can be accessed through async functions instead.

~~~
blacksqr
One nice thing about Tcl vs. Node: Tcl doesn't crash if there's an error in
one of the asynchronous call stacks. The Tcl interpreter catches the error and
passes it to a (customizable) background error processor, and keeps going.

