March 18, 2021
Things would improve drastically if std wasn't designed with assumptions on how user will use something

STD should be here to serve as a base for people to design libraries, not to enforce how libraries should be designed, because it'll only serve one way to write software

Fine for C# when microsoft want to sell their ASP.NET on Azure, but it's not good if it's something like C++, now everyone complain and rewrite their own STL, for the better, i feel the same with D's STD (the language itself is perfect)
March 18, 2021
On Thursday, 18 March 2021 at 18:29:34 UTC, ryuukk_ wrote:
> That's how i feel about it, people didn't care enough and easiest solution picked (let's put this lib instead), now you have to use a feature, as a lib, calling functions that looks like template functions, in the end it is confusing
>
> i can switch(t), but i can't match(t), i need to use a different syntax

I cared enough to spend my free time for the last *three years* working on the sumtype library and submitting it for inclusion in Phobos. That's more than you've done, I'll bet.

I understand your frustration, but these kinds of disparaging comments are extremely disrespectful, and you should avoid making them if you want anyone to take your criticisms seriously.
March 18, 2021
On Thursday, 18 March 2021 at 18:15:29 UTC, Paul Backus wrote:
> On Thursday, 18 March 2021 at 18:06:45 UTC, ryuukk_ wrote:
>> I'm not a fan of the syntax.. why is it a library instead of a language feature?..
>
> Because it's easier to write a library than to go through the whole process of writing a DIP for a new language feature, getting it accepted, and implementing it in the compiler.
>
> If you or anyone else wants to write a DIP to add sum types to D as a language feature, I will happily support the effort, but I am not going to do it myself.
>

The syntax is a result of it not being a language feature (the lib itself is perfectly fine, don't get me wrong! but the problem i have is it'd be better as a language feature)

I'd love to help create a DIP for it, but making it as a lib now, and then removing it few months/year later will feel bad because that's gonna be code people will have to change, again, hence the importance of not taking shortcuts, we need think long term
March 18, 2021
On Thursday, 18 March 2021 at 18:09:38 UTC, Paul Backus wrote:
> union U1 { int n; float f; }
> union U2 { float f; int n; }
>
> static assert(is(U1 == U2)); // fails
>
> D is a nominally-typed language, not a structurally-typed one. That means types that are structurally identical (like the unions and SumTypes in the above examples) are still considered separate types if their names are spelled differently.
>
> IMO the behavior of SumType in this regard is perfectly consistent with the rest of the language. If you want to use structural typing instead of nominal typing in your own code, you can define template predicates to check for SumTypes with a particular structure, the same way Phobos defines predicates like `isInputRange` to check for types with a particular structure.

okey, I agree

but read-only tag (kind, type index) is key feature in chouse between sumtype and other for me, and I hope it will be added before next compiler release...

March 18, 2021
On Thursday, 18 March 2021 at 18:40:01 UTC, Paul Backus wrote:
> On Thursday, 18 March 2021 at 18:29:34 UTC, ryuukk_ wrote:
>> That's how i feel about it, people didn't care enough and easiest solution picked (let's put this lib instead), now you have to use a feature, as a lib, calling functions that looks like template functions, in the end it is confusing
>>
>> i can switch(t), but i can't match(t), i need to use a different syntax
>
> I cared enough to spend my free time for the last *three years* working on the sumtype library and submitting it for inclusion in Phobos. That's more than you've done, I'll bet.
>
> I understand your frustration, but these kinds of disparaging comments are extremely disrespectful, and you should avoid making them if you want anyone to take your criticisms seriously.

I apologies if i sounded rude or disrespectful, that wasn't my intention

As i said in the other reply, sumtype as a library is excellent, sumtype in the std on other than is where i disagree, if inclusion, that would be as a language feature, to be useful for everyone, and to enhance the syntax for everyone
March 18, 2021
On Thursday, 18 March 2021 at 18:40:49 UTC, ryuukk_ wrote:
> I'd love to help create a DIP for it, but making it as a lib now, and then removing it few months/year later will feel bad because that's gonna be code people will have to change, again, hence the importance of not taking shortcuts, we need think long term

There is no need to remove the library even if a built-in version is added. The library version can simply be updated to alias itself to the built-in version, and its documentation can be hidden to discourage new code from using it.
March 19, 2021
On Thursday, 18 March 2021 at 18:42:32 UTC, Oleg B wrote:
>
> but read-only tag (kind, type index) is key feature in chouse between sumtype and other for me, and I hope it will be added before next compiler release...

https://github.com/pbackus/sumtype/pull/57
https://github.com/dlang/phobos/pull/7886
March 19, 2021
On Thursday, 18 March 2021 at 18:09:38 UTC, Paul Backus wrote:
> On Thursday, 18 March 2021 at 17:24:13 UTC, Oleg B wrote:
>> May be depending on order of types must be fixed too
>>
>> ```
>> alias S1 = Sumtype!(int, float);
>> alias S2 = Sumtype!(float, int);
>>
>> static assert (is(S1 == S2)); // false by now
>> ```
>> because no different between S1 and S2 in practice use
>
> union U1 { int n; float f; }
> union U2 { float f; int n; }
>
> static assert(is(U1 == U2)); // fails

Even

    union U1 { int n; float f; }
    union U2 { int n; float f; }

    static assert(is(U1 == U2)); // also fails

If types have different names, they're considered different. It's that simple. S1 and S2 shouldn't be considered equal IMO.
March 19, 2021
On 3/18/21 9:42 PM, Oleg B wrote:
> 
> but read-only tag (kind, type index) is key feature in chouse between sumtype and other for me, and I hope it will be added before next compiler release...
> 

Totally agree, it is an important feature.
March 19, 2021
On Friday, 19 March 2021 at 07:28:19 UTC, drug wrote:
> On 3/18/21 9:42 PM, Oleg B wrote:
>> 
>> but read-only tag (kind, type index) is key feature in chouse between sumtype and other for me, and I hope it will be added before next compiler release...
>> 
>
> Totally agree, it is an important feature.

https://github.com/pbackus/sumtype/pull/57
https://github.com/dlang/phobos/pull/7886