What is your idea? Provide a use case.
You can't really do the following:
type MyDatumA {...}
type MyDatumB {...}
let some_datum: Data = ...
when some_datum is {
MyDatumA {..} -> ...
MyDatumB {..} -> ...
_ -> ...
}
You have to use expect and that will make the code fail, so you can't properly handle it if you want to.
Also the MyDatumA/B can have multiple constructors, so there needs to be some good approach for this.
Why is it a good idea?
It's a necessary feature in my opinion. You want to be able to pattern match the Data type without failing.
The problem is that constructors of different types can have the same index so the whole structure has to be compared and a compiler error needs to be raised in case of ambiguous pattern match (when 2 constructors can't be differentiated).
What is the current alternative and why is it not good enough?
You need to have MyDatumA and MyDatumB as constructors in the same type which makes it inconvenient.
What is your idea? Provide a use case.
You can't really do the following:
You have to use
expectand that will make the code fail, so you can't properly handle it if you want to.Also the
MyDatumA/Bcan have multiple constructors, so there needs to be some good approach for this.Why is it a good idea?
It's a necessary feature in my opinion. You want to be able to pattern match the Data type without failing.
The problem is that constructors of different types can have the same index so the whole structure has to be compared and a compiler error needs to be raised in case of ambiguous pattern match (when 2 constructors can't be differentiated).
What is the current alternative and why is it not good enough?
You need to have
MyDatumAandMyDatumBas constructors in the same type which makes it inconvenient.