Justwerk compiler flag

Luna luna at foxgirls.gay
Sat Jul 19 20:58:39 UTC 2025


On Thursday, 17 July 2025 at 20:12:46 UTC, monkyyy wrote:
> On Thursday, 17 July 2025 at 18:05:08 UTC, Dukc wrote:
>> Are there often problems that the particular hack of mutating 
>> immutable data would resolve?
>
> Modifying strings live with range hacks instead of generally 
> handholding it during several layers

Depending on where the string comes from this would cause you to 
write to read-only memory,
causing your application to segfault; sometimes randomly.

> Immutablity of strings mainly prevents segfualts of attempting 
> to modify litterals in my code, thats the os being annoying but 
> sometimes it does get a line number that needs a .dup

If you know the string is in rw memory; just 
`(cast(char[])myString)`, no?

> Im generally using my own data structures, but if phoboes 
> shipped more useful ones(im imagining python-like datastructure 
> aware filters on opIndex being something that could be a use, 
> and would guaranteed embrace these harmful ideas) I imagine 
> there would be more cases of unnecessary immutably

Enforcing types invariance is a good thing, not harmful given it 
not only signals the possibility of the data to be read-only; but 
also the behaviour of the compiler during codegen.

>> In the case of @safe and private, can't you simply not use 
>> them when they get in the way

Sometimes things are private for a reason; for example if the 
implementation details of them would break some sort of state 
management if used improperly that would segfault your 
application. As for safe; it exists to prevent code from doing 
stupid things that should be relegated to low level libraries 
that have no choice.

It's a good thing it exists as it prevents a large class of error 
scenarios (and security weaknesses) from sneaking into code that 
may be hosting your bank details or whatever.

> Other people make mistakes, its very sad; I dont actually want 
> to be as independent as adr sitting on my 100000 lines of code 
> after 10 years.

I very much am unsure what you're trying to say there. The D 
ecosystem needs high quality packages to be written for it for it 
to be more widely useful. And that entails people sitting down 
and doing the necessary work of writing D native code that fits 
within the D paradigm.




More information about the dip.ideas mailing list