frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Adding keyword parameters to Tcl procs

https://world-playground-deceit.net/blog/2025/04/adding-keyword-parameters-to-tcl-procs.html
58•BoingBoomTschak•2mo ago

Comments

andrewshadura•2mo ago
Tcl is the shell done right. Simple, logical, consistent.
BoingBoomTschak•2mo ago
Well, it's certainly much better, especially now that we have dicts to replace arrays. But the specter of https://wiki.tcl-lang.org/page/exec+ampersand+problem (cf https://core.tcl-lang.org/tips/doc/trunk/tip/424.md) still looms.
grewsome•2mo ago
Tcl does appear to be a command language done right, I don't think there is a better one. As it was designed after bash etc, I guess the Tcl developers could see the inconsistencies there, which helped them do Tcl right.
IshKebab•2mo ago
Well... Yes and no. It's definitely better than most shells, but that's a very low bar. It's pretty awful compared to any "real" programming language, which is a problem because it's used in places where a real programming language would be much more appropriate.
grewsome•2mo ago
Tcl is a real programming language, but it depends on what you are doing with it. There are a lot of people who have never come into contact with command languages, and so there are plenty that look at it and have a negative response. For a lot of people though, Tcl is as easy to program in as Python or any other scripting language. It's a heck of a lot _easier_ to program in than a lot of so called real programming languages. I've found Ousterhout's dichotomy to be true, using two languages for a codebase is very efficient, but again, it'll depend on what you're doing.
IshKebab•2mo ago
It depends what you mean by easy. There are fewer features sure, but it's kind of like saying building a house with just a hand saw and a hammer is easy. Sure there are fewer tools to learn if you don't use CAD, power tools, laser levels, etc. But it's a bit dubious to say it's easier.
grewsome•2mo ago
Tcl doesn't have fewer features, it packs in a lot, probably because of its maturity, to a similar level as other mature scripting languages (OO, coroutines, event loop, slave interps, etc, etc). But it's poor when you want something to run quick, or if you want to carefully manage memory because you have a lot of data. Also there is no typing, and for large code bases that is detrimental. But by using two languages you can get the best of both worlds. But then you need to program competently in two languages, and that takes a surprising amount of experience, and the hand saw and hammer analogy isn't accurate in this case.
tracnar•2mo ago
I implemented something very similar a while ago, it's indeed too bad it's not built-in. I don't think you need such a "quasiquote" function, [list {*}$args] can escape a single command, and then it's a matter of joining multiple commands using a newline. IIRC that's how I did it.

I also had further fun with wrapping "proc" by implementing a "pyproc" which called out to Python while looking like a normal Tcl proc.

BoingBoomTschak•2mo ago
The problem is mainly the square brackets that force one to go through strings, in my experience. Can't build something like "set foo [cmd $bar]" purely by using [list ...] shenanigans, since list will quote stuff you don't want quoted.
tracnar•2mo ago
True, I believe I mostly worked around that limitation by splitting off quoted from unquoted code into separate commands. So in your example "[cmd $bar]" would be in a separate unquoted command, probably putting it in a temporary variable, which can cause problems as it's hard to have a private scope when doing metaprogramming. You can also use "[list]" in the middle of code, but it gets more error prone, for example "set foo \[[list cmd \$bar]\]"

For sure there is a lack of proper "code as data" constructs in Tcl, like you would find in Lisp.

BoingBoomTschak•2mo ago
Actually, you can see the "backslash hell" version here if you want to estimate the clarity gains: https://git.sr.ht/~q3cpma/tcl-misc/tree/f613898c3dcfa3ca958a...
blacksqr•2mo ago
The OpenACS web server toolkit has a lot of useful Tcl utilities, including the ad_proc procedure, which wraps proc and allows adding of switches, inline docs, and more.

I think it would be very useful to turn ad_proc into a built-in command and incorporate it into TCL.

https://nstcl.sourceforge.net/docs/nstcl-core/ad_proc.html

shawn_w•2mo ago
Personally I'm a fan of TEPAM from tcllib, which does much the same (and tcllib is available through many OS's package managers making it more readily available)

https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/tclli...

grewsome•2mo ago
For incorporating into Tcl I'd prefer something simpler that would also work with existing procs. Building on {*}, maybe {@} could work (to skip over arguments to a specified argument}. e.g. when calling a function: someFunc someVal anotherVal {@}someArgName yetAnotherVal
jrapdx3•2mo ago
As a search of the Tcl wiki shows, attempts to add named-argument capability to the Tcl proc command have been around for several years.

My own nxproc extension is more comprehensive. (See wiki [0].)

The extension enables named arguments, regular positional arguments, and 'rest' arguments, nxargs and nxunknown. Nxproc also provides (optional) type-checking of procedure arguments. (Types: string, number, bool and enumerated. Enums are lists of values restricting what the arg can contain.)

Nxproc supports TclOO with nxcontructor and nxmethod commands -- same feature set as "plain" nxproc. Also provides case-insensitive '-ci' variants, and runtime display of named-argument default/actual values and types.

Nxproc is a Tcl C extension. Bundle has Windows, Linux binaries. Compiles easily on other platforms.

[0] https://wiki.tcl-lang.org/page/nxproc

sigzero•2mo ago
That looks very nice!
RicoElectrico•2mo ago
Synopsys tools (either CosmosScope or Custom Wave view) do it by the way of names following values. Like:

    measureFoo $signal threshold 0.9 edge last

Armin Ronacher on Agentic Coding

https://www.youtube.com/watch?v=nfOVgz_omlU
1•paulsutter•1m ago•0 comments

Super Simple "Hallucination Traps" to detect interview cheaters

2•EliotHerbst•9m ago•0 comments

A customizable and extensible all-purpose diagrams library for Blazor

https://github.com/Blazor-Diagrams/Blazor.Diagrams
1•mountainview•11m ago•0 comments

Coinbase Acquires LiquiFi

https://www.coinbase.com/es-la/blog/Coinbase-acquires-LiquiFi-the-leading-token-management-platform
1•wslh•12m ago•0 comments

Trans-Taiga Road:The farthest you can get from a town on a road in North America

https://www.jamesbayroad.com/ttr/index.html
2•jason_pomerleau•15m ago•0 comments

Checklist Genie App – Last Call for Beta Testers

https://checklistgenie.app
1•alohaplannerapp•16m ago•0 comments

Show HN: I created a privacy respecting ad blocker for apps

https://www.magiclasso.co/insights/app-ad-blocking/
1•bentocorp•17m ago•0 comments

An Analysis of Links from the White House's "Wire" Website

https://blog.jim-nielsen.com/2025/links-from-whgov-wire/
1•OuterVale•25m ago•0 comments

Why are my Product Hunt upvotes delayed

https://www.ceresai.xyz/
1•Mahsanziak9•33m ago•2 comments

Qualcomm's Centriq 2400 and the Falkor Architecture

https://chipsandcheese.com/p/qualcomms-centriq-2400-and-the-falkor
1•brian_herman•34m ago•0 comments

Bridging Shopify and Shipstation on Heroku: A Story of Custom Fulfillment

https://kevinhq.com/shopify-shipstation-heroku-integration/
1•kevinhq•37m ago•0 comments

My official list of post-glitch.com hosting options

https://livelaugh.blog/posts/glitch-alternatives/
1•raybb•39m ago•1 comments

All high value work is deep work, and all motivation is based on belief

https://www.reddit.com/r/ExperiencedDevs/s/qV1w0XeFPw
2•Crier1002•40m ago•0 comments

'There is a problem': Meta users complain of being shut out of their accounts

https://www.bbc.com/news/articles/cvgnp9ykm3xo
4•mikece•41m ago•1 comments

Mount Everest's Trash-Covered Slopes Are Being Cleaned by Drones

https://www.bloomberg.com/news/features/2025-07-03/dji-drones-clean-up-mount-everest-trash-in-record-time-amid-climate-change
2•nharada•42m ago•2 comments

Gaming on a Medical Device [video]

https://www.youtube.com/watch?v=rf-efIZI_Dg
1•JKCalhoun•43m ago•1 comments

Open Source 1.7tb Dataset of What AI Crawlers Are Doing

https://huggingface.co/datasets/lee101/webfiddle-internet-raw-cache-dataset
3•catsanddogsart•49m ago•0 comments

Microsoft will lay off 9k employees, or less than 4% of the company

https://techcrunch.com/2025/07/02/microsoft-will-lay-off-9000-employees-or-less-than-4-of-the-company/
5•mrcsharp•50m ago•2 comments

Whole-genome ancestry of an Old Kingdom Egyptian

https://www.nature.com/articles/s41586-025-09195-5
3•A_D_E_P_T•57m ago•0 comments

NYT to start searching deleted ChatGPT logs after beating OpenAI in court

https://arstechnica.com/tech-policy/2025/07/nyt-to-start-searching-deleted-chatgpt-logs-after-beating-openai-in-court/
6•miles•59m ago•0 comments

AI virtual personality YouTubers, or 'VTubers,' are earning millions

https://www.cnbc.com/2025/07/02/ai-virtual-personality-youtubers-or-vtubers-are-earning-millions.html
3•pseudolus•1h ago•0 comments

US rural communities bearing the brunt of Bitcoin mining

https://www.dw.com/en/us-rural-communities-bearing-the-brunt-of-bitcoin-mining/a-72889383
4•musha68k•1h ago•1 comments

gmailtail: tail -f Your Gmail

https://github.com/c4pt0r/gmailtail
1•c4pt0r•1h ago•0 comments

A Non-Partisan U.S. Military Is Essential

https://time.com/7296041/non-partisan-military-is-essential/
4•herecomethefuzz•1h ago•0 comments

What to build instead of AI agents

https://decodingml.substack.com/p/stop-building-ai-agents
36•giuliomagnifico•1h ago•24 comments

Flint, Michigan replaces most lead pipes 10 years after Michigan water crisis

https://www.nbcnews.com/news/us-news/flint-replaces-lead-pipes-10-years-michigan-water-crisis-rcna216442
4•toomuchtodo•1h ago•1 comments

Nebius emerged from Russia as one of Nvidia's top-performing investments

https://sherwood.news/tech/nebius-nvidia-gpus-ai-startup/
2•gmays•1h ago•0 comments

One Life

https://thisisyouronelife.com/
1•tasshin•1h ago•0 comments

Project West Ford: Cold War Plan to Solve Radio Problems with 480M Space Needles

https://multiverseemployeehandbook.com/blog/when-america-tried-to-gift-wrap-the-planet/
1•6forward•1h ago•0 comments

When Code Writes Itself: The Dawn of Just‑in‑Time Software

https://zergai.com/blog/when-code-writes-itself
2•idanb•1h ago•0 comments