19 hours ago

On Monday, 20 October 2025 at 15:32:48 UTC, Steven Schveighoffer wrote:

>

On Monday, 20 October 2025 at 14:43:05 UTC, Steven Schveighoffer wrote:

>

This is a bug, introduced in 2.111.0

https://github.com/dlang/dmd/issues/22004

PR now added. Thank you for posting this, as this was my error when adding the new GC API in the last version!

-Steve

16 hours ago

On Tuesday, 21 October 2025 at 10:28:52 UTC, Brother Bill wrote:

>

On Tuesday, 21 October 2025 at 02:42:07 UTC, monkyyy wrote:

>

On Tuesday, 21 October 2025 at 02:08:41 UTC, Brother Bill wrote:

>

If there are valid cases where breaking sharing is intentional and useful, kindly share some of those scenarios.

appending a null to a string for toStringz

Do you mean appending an ASCII NUL character 0x00 to a string to make it C language friendly?

yes

16 hours ago

On Tuesday, 21 October 2025 at 20:07:48 UTC, Steven Schveighoffer wrote:

>

FWIW, this is not what happens in phobos toStringz, it just appends without concern of this use case.

Phoboes writing a one maybe 3 line function as 50 lines not withstanding string toStringz(string s)=>s~'\0';

As I said in a format debate thread:

The api constants here makes a worse of both worlds situation; 99.99999% your got your of block of data from os, lets say csv but its anything. You find the comma, and because dlang has immutable here, you cant just replace the comma with a null, because c apis you need 1 extra space, you copy the whole thing to make c code happy. And yes this will be true the majority of the time.

Worse of both worlds, but the apis would be to be drastically changed to fix.

15 hours ago

On Tuesday, 21 October 2025 at 20:09:01 UTC, Steven Schveighoffer wrote:

>

PR now added. 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

13 hours ago

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. 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.

13 hours ago

On Tuesday, 21 October 2025 at 23:16:48 UTC, monkyyy wrote:

>

On Tuesday, 21 October 2025 at 10:28:52 UTC, Brother Bill wrote:

>

On Tuesday, 21 October 2025 at 02:42:07 UTC, monkyyy wrote:

>

On Tuesday, 21 October 2025 at 02:08:41 UTC, Brother Bill wrote:

>

If there are valid cases where breaking sharing is intentional and useful, kindly share some of those scenarios.

appending a null to a string for toStringz

Do you mean appending an ASCII NUL character 0x00 to a string to make it C language friendly?

yes

I'm a bit obsessive-compulsive of the difference between null (pointer) and NUL, the first ASCII character.

As far as your example, escaping to the heap is one approach.
Another is to make a copy of the slice, then append NUL character.

1 2 3
Next ›   Last »