News for hackers. Stuff that matters.
Re:picol: A Tcl interpreter in 500 lines of code by iberator on Monday February 16, 2026 @04:20AM (#47032787)
best thing about TCL is easy syntax and that everything is a string :) Unique and simple and easy language with very slow changes.

Something like Python in good old days of 2.x before young internet javasceipt devs started pouring A LOT of new features to the language (feature creep).

Nowadays Python is so complex and flooded with ex C, C++, Java, JavaScript, Haskell programmers adding so many features, so fast that it's impossible to follow and understand them :(

Languages should not evolve on that rate. No time to master it :(

/rant

Re:picol: A Tcl interpreter in 500 lines of code by pjmlp on Monday February 16, 2026 @07:09AM (#47034048)
Tcl has stopped being everything a string with the release of Tcl 8.0 and bytecode engine.

> In earlier versions of Tcl, strings were used as a universal representation; in Tcl 8.0 strings are replaced with Tcl_Obj structures ("objects") that can hold both a string value and an internal form such as a binary integer or compiled bytecodes.

http://www.ira.inaf.it/Computing/manuals/tcl/man-8.0/Changes...

I remember this quite well, because as part of the core team tasked with writing native C extensions, the migration to Tcl 8 had quite an impact on our code.

I learned Python with version 1.6, and have a few O'Reilley books proving the point the language wasn't really that simple, those that never bothered reading the reference manuals end-to-end though it was.

Re:picol: A Tcl interpreter in 500 lines of code by apgwoz on Monday February 16, 2026 @12:54PM (#47037994)
There have always been attempts at caching non-string values in Tcl for performance gains, but the semantics are the same. The value’s types are whatever the operator requires and an error when not compatible. If, internally, $x is an integer, and you pass it to a string function, well, $x gets temporarily turned into a string. Dynamic with “weak” types.
Re:picol: A Tcl interpreter in 500 lines of code by pjmlp on Monday February 16, 2026 @02:55PM (#47039488)
Which is exactly the quoted text.
Re:picol: A Tcl interpreter in 500 lines of code by apgwoz on Monday February 16, 2026 @04:06PM (#47040334)
No. The quoted text says nothing about the value semantics, only the representation…
Re:picol: A Tcl interpreter in 500 lines of code by pjmlp on Monday February 16, 2026 @04:51PM (#47040820)
Well, if you followed the link under the quoted text, you would get the next sentence,

> The new objects make it possible to store information in efficient internal forms and avoid the constant translations to and from strings that occurred with the old interpreter.

Re:picol: A Tcl interpreter in 500 lines of code by apgwoz on Monday February 16, 2026 @06:53PM (#47041940)
Huh? I know how it works. My point is different than the representation.
Re:picol: A Tcl interpreter in 500 lines of code by robinsonb5 on Monday February 16, 2026 @05:30AM (#47033373)
There's certainly something to be said for stable, uncomplicated and minimalist tooling that wont evolve out from under you and leave you with something that won't just-work five years from now.

I guess that's why Tcl is so popular in the EDA arena. I can stick some custom JTAG tooling in a Cyclone II design and talk to it by Tcl-scripting the 15-year-old software - and be confident that the same code (both in the FPGA and on the host computer) would work with the latest software and a current device.

Having said that, Tcl's not entirely free of compatibility and fragmentation frustrations: I sometimes wish that OpenOCD used full-fat Tcl rather than JimTcl, just so that I could make use of Tk. Being able to plot a histogram of data collected from the FPGA or make clickable buttons to trigger events is very useful.

Re:picol: A Tcl interpreter in 500 lines of code by tonyedgecombe on Monday February 16, 2026 @05:06AM (#47033173)
I agree, so much for the benevolent dictator idea.
Re:picol: A Tcl interpreter in 500 lines of code by Pay08 on Monday February 16, 2026 @04:30AM (#47032866)
That's certainly a take...
Re:picol: A Tcl interpreter in 500 lines of code by IshKebab on Monday February 16, 2026 @04:25AM (#47032827)
> best thing about TCL is easy syntax and that everything is a string :)

What? That's the worst thing about TCL.

Re:picol: A Tcl interpreter in 500 lines of code by antirez on Monday February 16, 2026 @06:19AM (#47033709)
It depends on the use case. For instance you open a socket, write there any value you have without serialization, read it in the other side, data transfer done.
Re:picol: A Tcl interpreter in 500 lines of code by petcat on Monday February 16, 2026 @07:00AM (#47033975)
The convenience of not having to marshal data over a network is certainly a use case. But I'll admit that two of the worst programs I ever saw were written in Perl and TCL. Somehow just a big jumble of inscrutable regexes.

When "everything is a string" then you have no choice but to literally treat everything as a string. Painful. Very cool project though.

Re:picol: A Tcl interpreter in 500 lines of code by graemep on Monday February 16, 2026 @08:02AM (#47034474)
That sounds more like someone who over-uses regexes - the developer is the problem, not the language

TCL has a lot of options for manipulating strings - take a look at just the built in string command for a start: https://www.tcl-lang.org/man/tcl8.4/TclCmd/string.htm

I have seen terrible code in Python, C, and more.

Re:picol: A Tcl interpreter in 500 lines of code by Treblemaker on Tuesday February 17, 2026 @12:14AM (#47043937)
The objections to tcl I see most often seem to reflect an outdated or incomplete understanding of the language and its capabilities.

As with many interpreted languages, maybe it's just too easy to iterate interactively with code until it "just works", rather than taking the time to design the code before writing it, leading to perception that it is a "write-only" language.

However, despite its reputation, even Perl can be written in a way that is human-readable. I agree with you that it is more a reflection of the programmer or the work environment than of the language itself.

Re:picol: A Tcl interpreter in 500 lines of code by Treblemaker on Tuesday February 17, 2026 @12:06AM (#47043893)
> When "everything is a string" then you have no choice but to literally treat everything as a string.

As someone who has been developing tcl almost daily for more than 30 years, both object oriented and imperative code, I have not found it necessary to think this way.

Can you explain what leads you to this conclusion?

Re:picol: A Tcl interpreter in 500 lines of code by bmacho on Monday February 16, 2026 @05:35AM (#47033412)
It's only the interface that is of a string. An array is a list of strings with space between, but only for the programmer. The runtime is free to use an actual array.
Re:picol: A Tcl interpreter in 500 lines of code by IshKebab on Monday February 16, 2026 @07:36AM (#47034258)
I'm aware. It's awful because of the implications for the programmer, not the runtime.
Re:picol: A Tcl interpreter in 500 lines of code by iberator on Monday February 16, 2026 @04:49AM (#47033025)
I love it. Living proof that languages doesn't need forced types.

Data is Data. It's kinda object programming as visioned in the 70".

So easy and trivial language.

Re:picol: A Tcl interpreter in 500 lines of code by IshKebab on Monday February 16, 2026 @07:40AM (#47034285)
> Living proof that languages doesn't need forced types.

The opposite surely? TCL is practically dead, and only lingers on in the EDA industry (which has zero taste). Virtually every successful language today has at least a few different basic types for numbers, arrays, strings, maps and so on.

Re:picol: A Tcl interpreter in 500 lines of code by bmacho on Monday February 16, 2026 @07:48AM (#47034344)
Tcl has these types as well. They are special strings.

Number: string of digits. List: strings separated by space. Dictionary: key value pairs in a list.

Re:picol: A Tcl interpreter in 500 lines of code by IshKebab on Monday February 16, 2026 @03:40PM (#47040051)
No they aren't. Everything is a string. The runtime does some optimisation where it actually does use different types under the hood but they don't change the semantics.

If you try to pass a list into a function expecting a string it will just treat the list as a string. No type error or anything, not even at runtime.

CMake is the same. Terrible design. Real types are useful.

Re:picol: A Tcl interpreter in 500 lines of code by ux266478 on Monday February 16, 2026 @10:49AM (#47036508)
TCL's typicing discipline comes from shell languages and awk, which are decidedly not dead. The overwhelming majority of programmers have less than no taste, so language usage rates in general don't really mean much.
Re:picol: A Tcl interpreter in 500 lines of code by isr on Monday February 16, 2026 @05:01PM (#47040924)
Well, if you use flightaware to track flights, you're using tcl. The vast majority of their codebase is in tcl.
Re:picol: A Tcl interpreter in 500 lines of code by zwischenzug on Tuesday February 17, 2026 @09:20AM (#47047747)
If you place a sports bet online, odds (!) are that it will run through tcl in its business logic. I may even have written some of it.
Re:picol: A Tcl interpreter in 500 lines of code by tverbeure on Monday February 16, 2026 @11:14AM (#47036840)
The worst thing about tcl is that it exists... and it's still the language of choice for EDA tools.
Re:picol: A Tcl interpreter in 500 lines of code by xantronix on Monday February 16, 2026 @11:36AM (#47037084)
I'd be curious to know what your experiences with Tcl have been, to better understand why you feel this way.
Re:picol: A Tcl interpreter in 500 lines of code by elevation on Monday February 16, 2026 @03:24PM (#47039847)
It's a combination of cumbersome syntax and the vendor's poor API design and execution environment.

For a syntax example, compare python to Tcl. In python, there's a compact array lookup operator, and dictionaries allow string keys:

  mydata["channel"][2]
Tcl, however, requires a function call to access an array index, resulting in nested function calls with magic numbers for the simplest expressions:

  lindex [lindex $mydata 35] 2  # Tcl 
Then there isn't any static type checking so you have to run code to see if it would work; the shape of a return may surprise you. Connecting to hardware may be your only opportunity to exercise certain code paths.

So for any non trivial task, Tcl becomes effectively write-only.

Some tools allow you to export Tcl scripts that automate tasks like project creation to help you avoid tracking intermediate objects in source control, but because the Tcl cwd path can change throughout a script, they export every source path as a hard coded absolute path, including whatever developer's home directory it might be residing in. This is not suitable for source control (because it would preclude building on any other machine) so then you have to post process these scripts before tracking them. But since it's Tcl there aren't good scriptable tools for programmatic Tcl AST manipulation, so you have to modify these files with some sort of a state machine, looking for various sentinels to trigger the various string replace behaviors you need. It's not all Tcl's fault, but if a vendor is only using Tcl for automation and you need automation, you have a battle ahead of you.

Outside the language, you'll often find that your runtime tool locks the UI thread to run your scripts, so long running operations are impossible to pause or cancel. And I've never seen a vendor expose adequate objects to allow full control, so often, the critical actions you hoped to automate are only possible through the GUI.

In the 90s, an integrated Tcl interpreter was a good sign that your vendor cared about developers. Today it's more a sign of neglect.

Re:picol: A Tcl interpreter in 500 lines of code by xantronix on Monday February 16, 2026 @03:40PM (#47040034)
> Tcl, however, requires a function call to access an array index, resulting in nested function calls with magic numbers for the simplest expressions:

I do understand how that one can be frustrating to a newbie, but I can't fault that implementation choice when thinking about Tcl as a "Lisp but it's strings".

> Then there isn't any static type checking so you have to run code to see if it would work; the shape of a return may surprise you. Connecting to hardware may be your only opportunity to exercise certain code paths.

This, though, yeah. I feel this in my whole body. I haven't checked out Tcl 9.0 to see how it's changed, but Tcl 8.6's abbreviated compilation phase definitely doesn't leave any room for type much type inference ahead-of-time.

> sentinels

Tangential, but man I wish Tcl had `gensym` out of the box. That alone was enough to start my own programming language over a decade ago.

Everything else, I largely agree with. Short of a hard fork or the Tcl team splitting their time between maintaining for the sake of EDA vendors, and trying different approaches, I don't see much changing.

I really appreciate the time you took to share your experiences here.

Re:picol: A Tcl interpreter in 500 lines of code by shawn_w on Monday February 16, 2026 @04:19PM (#47040472)
You can just use

    lindex $mydata 35 2
for indexing nested lists, btw. Same for nested hash tables:

    dict get $mydata channel 2
Mixing the two does get ugly with nested functions, granted.
Re:picol: A Tcl interpreter in 500 lines of code by tverbeure on Monday February 16, 2026 @06:57PM (#47041961)
My experience with Tcl is 30 years of using EDA tools, all of them equipped with this language from hell. Luckily, I've been to restrict the scripting part to the minimum. I'm sure that if you know the language well, you can see the foundational model that's behind it, but for occasional users, there's nothing predictable about it.

I couldn't tell you exactly all the thing that are wrong with it. Let's just say that a language where this is ok:

puts "Hello"

But this is not:

puts "Hello" # A comment

shouldn't exist.

Re:picol: A Tcl interpreter in 500 lines of code by Treblemaker on Monday February 16, 2026 @11:46PM (#47043798)
Similar amount of experience with tcl here (since dc_shell-t was released). I love working in tcl. It can be expressive, redable, sufficiently performant, and makes it easy and fast to develop and test new features and functions in even very complex EDA design flows with 100k lines of code.

I find it curious that so many of the criticisms of tcl are that it doesn't have some feature or behavior of some other language. That has never stopped me from accomplishing what is needed with clear, elegant code.

Rule #10 in the Dodekalogue [0] explains why your preferred comment style is not supported: a command is not expected immediately after the last argument of the previous command. Terminate the command per rule #1 and it is perfectly fine:

puts "Hello" ;# A comment

Isn't that the same number of characters one would type to start a javascript comment? //

Almost any programming language can be beautiful in its simplicity if you work with it on its own terms. tcl doesn't deserve the hate.

[0] Dodekalogue is the common name for the twelve rules that define the syntax and semantics of Tcl. https://wiki.tcl-lang.org/page/Dodekalogue

Re:picol: A Tcl interpreter in 500 lines of code by hogehoge51 on Tuesday February 17, 2026 @03:02AM (#47044850)
Would you prefer dc-shell scripting?

(I still remember the excitement of EDA tools _starting_ to support TCL and replacing the custom scripting engines they used to have)