Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I skipped Tcl in favor of Perl. Is there any reason to reconsider nowadays?


Tcl is more-or-less required if you're involved with the physical design of silicon (most EDA tools only provide a Tcl interface). It's a good fit for that purpose. If you need a language which is easy to embed and you want non-programmers to be able to use it, Tcl is a good choice, though I've heard that Lua has supplanted Tcl for that purpose.


That's been my job for the last 30 years.

Our flow is thousands of lines of Tcl code around all the cadence and synopsys tools. Then we write more Tcl to create the power grid, create blockages, etc.


In the silicon industry it’s definitely tcl only. Zero Lua. But every tcl script I have seen is extremely simple, often just a bunch of commands to the EDA tool that reads like a list of bash commands.


Tcl scripting gets more interesting when you want to talk to a design running in an FPGA over JTAG. I have a toy CPU project which I've so far tested on Altera/Intel, Xilinx and Lattice FPGAs, and a debug interface where a C-based ncurses debugger connects over TCP/IP to a Tcl bridge which talks to the appropriate JTAG interface for the particular type of chip.

I'm also a big fan of the full-fat Tk-capable Tcl in Altera's SignalTap / Virtual JTAG - I used it recently to plot histograms on-demand for profiling RAM / Cache accesses.


That's one of the benefits of tcl, having a bunch of commands require as little syntax as possible.


I'd say python starts to make some strides, likely due to the AI hype train. But it's still mostly Tcl.


I dropped Perl for TCL decades ago, after I realized that I could read and understand my TCL code months after I’d written it, but my Perl code was totally opaque.


Looks like this post I made can serve again: https://world-playground-deceit.net/blog/2024/10/why-tcl.htm...

But to be honest, while I feel like Perl has a lot of advantages (full perlre, full access to POSIX APIs, slightly better performance), I still can't look at it and keep my last meal down. Tcl having an event loop and Tk being native are pretty nice too.


You mention Tcl’s lack of language server support - just a shameless plug for my own project that’s working on fixing this: https://github.com/nmoroze/tclint/blob/main/docs/lsp.md

It’s not quite “complete” with respect to all the usual LSP features (just does linting and formatting for now), but it’s a starting point!


I don't use language servers myself personally but wanted to give you a kudos for attempting something.


Well, thank you and good luck!


I like both Perl and TCL. If I need an executable for Windows, I choose TCL, because I can easily make one with freewrap.


Perl and Python have a myriad of similar tools that work well with projects with no dynamic imports.


I remember such wrappers for Perl and even for PHP.


I first encountered Tcl when trying to use the network simulator, ns2. Any language that lends itself to such hideous code can't be good, I thought, and stayed clear of it ever since.

https://www.isi.edu/websites/nsnam/ns/


TCL is embeddable (in another program). In fact that's how it started.

That means it's a good language to extend your program. I don't know how it compares to Lua, which seems to have replaced it in that space.


Lua is simple to bolt on to your project.

Perl is a nightmare to interop! They should have won an award for that. It took effort.

Python is slightly cleaner than perl, but not much.


You mean, the interpreter is available as a library with bindings in many languages?

But then - isn't that the case for other scripting languages these days? Or are they too complex and with "strings attached"?


I can't speak for other scripting languages, but it's absurdly easy both to embed Tcl as an interpreter in a larger project, and to create a Tcl extension which implements your own commands.


You're using the same words. What is "easy" about embedding TCL that is "difficult" about embedding Perl or Python? Can you spell this out?


Sorry, missed this at the time. But I did say I can't speak for other scripting languages. All I can say is that it was much easier than I was expecting!


One can leverage Lua in PHP, I think it's handy for user-supplied logic (eg: business rules)


I like TCL a lot more for this use case, and I don’t care for Lua at all; but Lua might be a better match for embedding in an OO language.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: