🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.tcl
Article #25

Re: Experiment: inline bytecode for [lrange] with variable indices (written by Claude)

#25
From: et99
Date: Thu, 08 Oct 2026 19:24
22 lines
3456 bytes
On 10/8/2026 11:34 AM, saito wrote:
> On 10/6/2026 9:19 PM, et99 wrote:
>>
>> I asked Claude (Anthropic's AI assistant), working in its sandbox with access to the GitHub mirror of the Tcl source, to add a new listRange instruction that always takes exactly three values from the stack: the list and both indices. It took about 20 minutes to get a complete patch with tests, after many build and test runs in the sandbox, including AddressSanitizer, Tcl's memory-debug build and the TCL_COMPILE_DEBUG build. I copied the changed files into my own tree, built, and ran the tests and a benchmark on two of my machines. Claude ran the same benchmark in its sandbox, which is the third column below.
>>
> 
> An AI assistant already knows about bytecodes to the degree that it can optimize it? Truly impressive.
> 
> Question/Suggestion: Expect on Windows is basically abandoned software at this point, and other platforms may follow suit soon. It is a nice piece of software and it seems to be popular enough to receive attention in articles and blogs here and there.
> 
> I wonder with your experience in directing Claude if it can offer a solution.
> 
> 

Well, the only way to find out is to give him the code to look at. In my bytecode experimenting I found some wiki code written back in 2013 by Richard Suchenwirth which no longer worked because of changes in the dissasembler output. Claude read the code, and resurrected it. This was a small case, but, if you can paste in all the code, he could probably give you an answer.

The one thing that does come up a lot is that he isn't able to read just everything on the internet. Many sites block his access. He had to find a way to get to the tcl source code using a github mirror, where I normally just access it directly at https://core.tcl-lang.org.

He only seems to have a linux sandbox, so you would have to do the testing for him. But with the sandbox, things are so much faster, he gives me code that he's checked himself now rather than code that I have to test. This means much less back and forth. I'm afraid with Expect on windows, you'd have to be his tester.

-et
Technical Details
Message-ID: <11a8qm9$539g$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11a46mp$2f14b$1@dont-email.me> <11a8nn7$3sdl$2@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: et99 <et99@rocketship1.me>
Newsgroups: comp.lang.tcl
Subject: Re: Experiment: inline bytecode for [lrange] with variable indices
 (written by Claude)
Date: Thu, 8 Oct 2026 12:24:56 -0700
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <11a8qm9$539g$1@dont-email.me>
References: <11a46mp$2f14b$1@dont-email.me> <11a8nn7$3sdl$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 08 Oct 2026 19:25:01 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="167216"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/2zWJFsvncX0hss635A+if"; posting-host="f99c1eab37cc5ad5c75580fd173b29c9"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:qbzrc4c9IG4ITNVrXo3pxaJvm3s= sha256:ul8Ln6q5DSv3QDmOtLWULhjxvDa9vcab91Q3E88BDQM=
	sha1:3mJ3JitGmLBeI58iTzwfXPaGbJ0= sha256:d5dMUizmxp9Iccb0wDOyd/5UgQFa4AApyEmfFrOCOCs=
Content-Language: en-US
In-Reply-To: <11a8nn7$3sdl$2@dont-email.me>