Debug help - Programming in D - extending tail slice terminates sharing unexpectedly. Page 69, 70

Brother Bill brotherbill at mail.com
Wed Oct 22 01:52:14 UTC 2025


On Tuesday, 21 October 2025 at 23:47:37 UTC, Andy Valencia wrote:
> On Tuesday, 21 October 2025 at 20:09:01 UTC, Steven 
> Schveighoffer wrote:
>> PR now [added](https://github.com/dlang/dmd/pull/22009). Thank 
>> you for posting this, as this was my error when adding the new 
>> GC API in the last version!
>
> Congrats, Brother Bill, I do believe that's the first 
> out-and-out bug you've discoverd!
>
> Andy

I'm old school, started with Machine Language on punch cards with 
IBM 1620 computer in 1969.

My first out-and-out bug discovery was on a Burroughs 5000 (if I 
remember right) and when writing to Channel 5, you were supposed 
to use two digits, as in 05.  I only typed in a single digit and 
was the first to do so.

This resulted in a three foot stack of printouts with a message 
to ship this to Burroughs Corporation.  Several weeks later, they 
came back with the explanation, and they modified the compiler so 
than one or two digits would be acceptable.

I'm working on building a very thorough Udemy course on D 
language based on Brother Ali's Programming in D book.  So I need 
to thoroughly test each skill in the book so that students can 
learn it without needing to read the D Specification.  Thus I 
find some errors inadvertently.

Generally, when a newbie finds an error, that is on the newbie's 
side.
This was a rare exception.

IMHO, slices should not escape to the heap, as the whole purpose 
of using slices is to have reference (shared) semantics.  
Escaping to the heap breaks sharing, which will generally break 
algorithms.  Thus breaking sharing should result in an exception.
But its probably a bit late to change the spec.


More information about the Digitalmars-d-learn mailing list