Frameworks and libraries

monkyyy crazymonkyyy at gmail.com
Fri Sep 15 22:39:22 UTC 2023


On Friday, 15 September 2023 at 20:38:12 UTC, Atila Neves wrote:
> On Friday, 15 September 2023 at 16:40:38 UTC, monkyyy wrote:
>> On Friday, 15 September 2023 at 16:09:44 UTC, bachmeier wrote:
>>> On Friday, 15 September 2023 at 14:50:27 UTC, monkyyy wrote:
>>>> d as is, is gc'ed to hell and back
>>>
>>> That's why I use it.
>>>
>>>> nogc is a bandaid to advertise its something its not.
>>>
>>> [This is what the spec 
>>> says](https://dlang.org/spec/function.html#nogc-functions). I 
>>> don't see anything wrong with it. It restricts what you can 
>>> do inside a function and that's what it's supposed to do.
>>
>> a language includes its std and there's no alternative for 
>> std: string, algorithm, range to be nogc'ed
>
> std.string, I get, but algorithm and range are poster children 
> for `@nogc`. I'm not going to claim that *nothing* in those 
> packages allocates on the GC heap, but I'd be very surprised if 
> there were many functions that did.
>
> Which is good because allocating when not needed is silly, not 
> because avoiding the GC is a good idea. It isn't. *If* your 
> program is slow *and* you profiled *and* it's GC allocation 
> that's slowing it down, then think about doing something else.

I'm mostly talking about existing data structures and string 
handling(strings being probably the most important data structure)

Given my definition of language above of compiler + std, a 
betterc project is probably using libc for strings and rolling 
their own data structures; at which point they can't use my 
code(I use import std casually) I don't want to use their code 
even if it even works.

Not getting involved in your attribute debates, to use 
std.algorithm I need data structures that were designed to work 
with it(and probably tested with it), and static arrays aren't on 
the list.

I mostly rant and rave about this on discord but I've been 
complaining about this for years, but for stepovs idea of 
templates where you get n*m solutions out of n+m code you should 
attempt to balance n algorithms with m data structures, and nogc 
by disabling the one good data structure makes 100ish algorithms 
x 1 ==100 into 100x0==0 making the situation so much worse.

If you want nogc to be usable(rn if I want to make something with 
wasm I would need to write a bunch of data structures), the 
problem with data structures, in general, should be addressed.


More information about the Digitalmars-d mailing list