You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implementing interface method returning byref<'t> cannot just throw #5776
It's by design. failwith is a generic function instantiated with the return type. The same would apply to Unchecked.defaultof<_>. Byrefs are just whacky wierd on .NET
We'll have to strongly consider doing work here. Since both raise and failwith are generic functions, you cannot throw an exception like you can in C#:
Yes, it would make sense to do something here, though it is a bit of a corner case. It's shame .NET generics have this limitation on byref instanatiations.
Activity
cartermp commentedon Oct 16, 2018
Thanks, that definitely looks like a bug.
dsyme commentedon Oct 18, 2018
It's by design.
failwithis a generic function instantiated with the return type. The same would apply toUnchecked.defaultof<_>. Byrefs are just whacky wierd on .NETYou can record a language suggestion if you like
cartermp commentedon Oct 18, 2018
We'll have to strongly consider doing work here. Since both
raiseandfailwithare generic functions, you cannot throw an exception like you can in C#:dsyme commentedon Oct 19, 2018
Yes, it would make sense to do something here, though it is a bit of a corner case. It's shame .NET generics have this limitation on byref instanatiations.
marklam commentedon Oct 19, 2018
Could the 'something' also encompass the pipe operator? (like #5286)
dsyme commentedon Oct 19, 2018
No. I'm very loathe to go down that long slippery slope since it's a bug farm.
Anything we do here would be for
raiseand nothing else. Not even forfailwith.marklam commentedon Oct 19, 2018
Fair enough :-)
cartermp commentedon Oct 19, 2018
@dsyme Do you still think a language suggestion is necessary, or should we just use this to track and update the RFC?
dsyme commentedon Oct 25, 2018
We can use this to track I suppose, special casing
raiseis finecartermp commentedon May 26, 2020
Filed: fsharp/fslang-suggestions#872