betterC becoming unusable

Steven Schveighoffer schveiguy at gmail.com
Mon Nov 7 03:59:28 UTC 2022


I had a person who was trying to use raylib-d using betterC.

They encountered 2 problems:

1. raylib-d was using Phobos to construct enums or in template 
constraints. Things have bizarre errors at compile-time. Like 
`isRange!MapResult` (from `std.algorithm.map`) is false. Why? Because 
it's checking for some "does this compile" checks, and they fail because 
betterC disallows using things. Which things? I don't know, because all 
the error says is, it's not an input range [1]. Now, you might say "Too 
bad, you can't just can't use phobos anyway". But this is being 
attempted in CTFE. So I don't *actually need* to link the runtime 
(though I bet if it were allowed, it would still fail to link, due to 
CTFE-used functions still being emitted).

2. Array comparison sometimes fails to link. That's right `string1 == 
string2` may fail depending on whether the compiler decides that the 
support template in druntime needs to be emitted to the object file. 
This is unacceptable. If I have to use `strcmp` in betterC, I might as 
well just use C.

There are fundamental problems here. Ones that aren't easy to fix. Using 
betterC just seems to be a worse experience than either using D or using 
C. Is there any hope for fixing this?

-Steve

[1](https://issues.dlang.org/show_bug.cgi?id=23468)


More information about the Digitalmars-d mailing list