November 12, 2020
On 12/11/2020 11:15 AM, ryuukk_ wrote:
> BetterC has many flaws
> 
> - you have to be explicit in your code with @betterC @noGC etc etc etc, it's ugly and  annoying

No you don't. There is no specific behavior there for -betterC.
November 12, 2020
On Thursday, 12 November 2020 at 00:21:16 UTC, rikki cattermole wrote:
> On 12/11/2020 11:15 AM, ryuukk_ wrote:
>> BetterC has many flaws

I think that the biggest flaw might be lack of numerated types in D - aka - safer unions. Without such a feature programming in Better C mode might not be that much better than C.

November 12, 2020
On Thursday, 12 November 2020 at 00:27:44 UTC, Dibyendu Majumdar wrote:
> On Thursday, 12 November 2020 at 00:21:16 UTC, rikki cattermole wrote:
>> On 12/11/2020 11:15 AM, ryuukk_ wrote:
>>> BetterC has many flaws
>
> I think that the biggest flaw might be lack of numerated types in D - aka - safer unions. Without such a feature programming in Better C mode might not be that much better than C.

They're available as a library:

https://code.dlang.org/packages/sumtype
November 12, 2020
On Thursday, 12 November 2020 at 00:27:44 UTC, Dibyendu Majumdar wrote:
> I think that the biggest flaw might be lack of numerated types in D - aka - safer unions. Without such a feature programming in Better C mode might not be that much better than C.

I think this is more of a problem for full D as it prevents the GC from doing precise collection.

November 12, 2020
On Thursday, 12 November 2020 at 00:48:24 UTC, Paul Backus wrote:
> On Thursday, 12 November 2020 at 00:27:44 UTC, Dibyendu Majumdar wrote:
>> On Thursday, 12 November 2020 at 00:21:16 UTC, rikki cattermole wrote:
>>> On 12/11/2020 11:15 AM, ryuukk_ wrote:
>>>> BetterC has many flaws
>>
>> I think that the biggest flaw might be lack of numerated types in D - aka - safer unions. Without such a feature programming in Better C mode might not be that much better than C.
>
> They're available as a library:
>
> https://code.dlang.org/packages/sumtype

Thanks. Although without language support it probably doesn't get you safety?


November 12, 2020
On Thursday, 12 November 2020 at 14:50:33 UTC, Dibyendu Majumdar wrote:
>
> Thanks. Although without language support it probably doesn't get you safety?

What do you mean? How isn't sumtype library safe? Why would a built in language sumtype be safer?
November 12, 2020
On Thursday, 12 November 2020 at 14:50:33 UTC, Dibyendu Majumdar wrote:
> On Thursday, 12 November 2020 at 00:48:24 UTC, Paul Backus wrote:
>>
>> They're available as a library:
>>
>> https://code.dlang.org/packages/sumtype
>
> Thanks. Although without language support it probably doesn't get you safety?

SumType is both type-safe and memory-safe, if that's what you're asking.
November 12, 2020
On Thursday, 12 November 2020 at 15:39:53 UTC, Paul Backus wrote:
> On Thursday, 12 November 2020 at 14:50:33 UTC, Dibyendu Majumdar wrote:
>> On Thursday, 12 November 2020 at 00:48:24 UTC, Paul Backus wrote:
>>>
>>> They're available as a library:
>>>
>>> https://code.dlang.org/packages/sumtype
>>
>> Thanks. Although without language support it probably doesn't get you safety?
>
> SumType is both type-safe and memory-safe, if that's what you're asking.

Hi no, my point was that it not being a language feature means that people have to consciously use it. And that means it is probably not going to be.

Also the compiler cannot assist you in making this choice.
November 12, 2020
On Thursday, 12 November 2020 at 18:07:08 UTC, Dibyendu Majumdar wrote:
> On Thursday, 12 November 2020 at 15:39:53 UTC, Paul Backus wrote:
>>
>> SumType is both type-safe and memory-safe, if that's what you're asking.
>
> Hi no, my point was that it not being a language feature means that people have to consciously use it. And that means it is probably not going to be.

I don't think it's quite so black-and-white. Sure, a language feature is more convenient to use than a dub package, but it's not by a huge amount--and in both cases, you have to make a conscious choice to use them. I don't think sumtype is any harder to use in your code than something like `@safe`, for example.

> Also the compiler cannot assist you in making this choice.

I'm not aware of any compiler, for any language, than can provide this kind of assistance. Until we invent AIs that can write code for us, we programmers are going to be stuck making our own choices. :)
November 12, 2020
On Thursday, 12 November 2020 at 18:33:39 UTC, Paul Backus wrote:
> On Thursday, 12 November 2020 at 18:07:08 UTC, Dibyendu

>
>> Also the compiler cannot assist you in making this choice.
>
> I'm not aware of any compiler, for any language, than can provide this kind of assistance. Until we invent AIs that can write code for us, we programmers are going to be stuck making our own choices. :)

Sorry I didn't make myself clear.
In Rust for example unions are unsafe whereas enumerated types aren't (caveat: this is based on my imperfect knowledge). So having it in the language allows the compiler to better infer safety of the code, and thus help the programmer make better choices.