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

Nothing's Untestable

https://antithesis.com/blog/2025/bugbash_2025/mitchell_hashimoto/
1•zdw•2m ago•0 comments

Show HN: I made a social media platform

https://onelined.tech/
1•sahil423•13m ago•0 comments

How to write Rust in the kernel part 1

https://lwn.net/Articles/1024202/
1•pkilgore•19m ago•0 comments

CEOs Start Saying the Quiet Part Out Loud: AI Will Wipe Out Jobs

https://www.wsj.com/tech/ai/ai-white-collar-job-loss-b9856259
1•planetjones•21m ago•1 comments

Debian on Apple M1/M2: status and call for testers

https://lists.debian.org/msgid-search/86037b55-e1b8-49e6-a0c9-f961b4ddc1a1@disroot.org
2•pabs3•22m ago•0 comments

GitHub Copilot coding agent now has a Playwright web browser

https://github.blog/changelog/2025-07-02-copilot-coding-agent-now-has-its-own-web-browser/
1•felineflock•23m ago•0 comments

Show HN: Piskvor Prime: a five-in-a-row iOS game with a reactive AI opponent

https://vojtahavlicek.github.io/vojtanyc/posts/piskvor_prime/
1•vh311•23m ago•0 comments

Show HN: Wyntk.ai – anti horseless carriage email

https://www.wyntk.ai/
1•gregorvand•24m ago•0 comments

Give Footnotes a Spec

https://nathansnelgrove.com/2025/07/give-footnotes-a-spec
1•OuterVale•28m ago•0 comments

Braess Paradox [video]

https://www.youtube.com/watch?v=-QTkPfq7w1A
1•travisgriggs•28m ago•1 comments

TPC-DS Benchmark: Trino 476, Spark 4.0.0, and Hive 4 on MR3 2.1

https://mr3docs.datamonad.com/blog/2025-07-02-performance-evaluation-2.1/
1•epdlxjmonad•30m ago•1 comments

Show HN: GenZ AI – Your Voice, but Fluent in Gen Z

https://twitter.com/MisbahSy/status/1940609386927521900
1•misbahsy•31m ago•0 comments

Ask HN: Building for Joy vs. Building for Scale

1•chbkall•32m ago•0 comments

OpenAI to Sponsor Driver Alex Palou at Mid-Ohio IndyCar Race

https://www.sportsbusinessjournal.com/Articles/2025/07/02/openai-gets-first-livery-position-with-ganassi-at-mid-ohio-as-ai-leader-looks-to-racing-for-insights/
1•tekdude•35m ago•0 comments

Learning F# with Falco: Response Localization

https://rewiring.bearblog.dev/learning-f-with-falco-response-localization/
1•Mossy9•37m ago•0 comments

Why the superyachts are getting bigger and bigger

https://www.bbc.com/news/articles/cvgnwx0lwwdo
1•andsoitis•39m ago•1 comments

Aphrodisiac

https://www.rxjourney.net/the-ultimate-aphrodisiac
1•chidieberechigo•40m ago•0 comments

Natasha Lyonne reveals David Lynch was a supporter of AI

https://faroutmagazine.co.uk/natasha-lyonne-reveals-david-lynch-supporter-ai/
2•CharlesW•46m ago•0 comments

Accelerate Legacy Application Modernization 4 times faster

https://www.techolution.com/products/appmod-ai-for-enterprises/
1•tech28•46m ago•0 comments

Third Interstellar Object Discovered

https://minorplanetcenter.net/mpec/K25/K25N12.html
2•gammarator•48m ago•0 comments

David Romero's Digital Models of Frank Lloyd Wright's Unrealized Buildings

https://www.thisiscolossal.com/2025/06/david-romero-frank-lloyd-wright/
2•CharlesW•48m ago•0 comments

You People Keep Contradicting Yourselves

https://www.taylor.gl/blog/27
1•taylorlunt•51m ago•0 comments

Windows 11 Start menu uses a 15 MB JSON for categories

https://www.windowslatest.com/2025/07/03/windows-11-start-menu-uses-a-15mb-json-not-ai-to-organize-apps-under-categories/
3•lcnmrn•56m ago•2 comments

2025 AsiaLLVM Developers' Meeting Talks

https://www.youtube.com/playlist?list=PL_R5A0lGi1ADKfJbzpA0rMDCb5T3QGe5k
1•matt_d•58m ago•1 comments

Open Co-Scientist Agents: Recreating Google's AI Co-Scientist in LangGraph

https://github.com/conradry/open-coscientist-agents
1•conradry•58m ago•0 comments

The Mechanic Johnny Cash and Elvis Would've Wanted (Toolbox Tour) [video]

https://www.youtube.com/watch?v=xrHtzSIh2GQ
1•meandave•59m ago•0 comments

What happens to your brain when you watch videos online at faster speeds

https://theconversation.com/what-happens-to-your-brain-when-you-watch-videos-online-at-faster-speeds-than-normal-259930
1•Duanemclemore•1h ago•2 comments

Is that a Lululemon Scuba hoodie or Costco dupe? No one has to know

https://www.washingtonpost.com/style/fashion/2025/01/25/costco-dupe-lululemon-scuba-hoodie-danskin/
2•walterbell•1h ago•0 comments

Has Xbox Considered Laying One Person Off Instead of Thousands

https://aftermath.site/xbox-layoffs-microsoft-phil-spencer
6•Narishma•1h ago•1 comments

Mr. Abrego's Account of Torture at CECOT in El Salvador

https://www.muellershewrote.com/p/mr-abregos-account-of-torture-at
8•tastyface•1h ago•1 comments