DEV Community

loading...

Discussion on: Span<T>

Collapse
t4rzsan profile image
Jakob Christensen

I am curious. In what ways do you consider C# generics to be flawed?

Collapse
entomy profile image
Patrick Kelly Author

I'll have to do a deep dive into this sometime, but the gist is this:

They are far too limited in what you can express. Two things I've seen in other languages, and greatly appreciated, is the ability to have generic value parameters, like an integer value as part of the template, and generic subroutine parameters, almost like a callback but instead of a subroutine pointer, it's actually templated on the subroutine instance. F# has the latter, which is a delight when working in it. Ada supports both, but lacks inline instantiation which is a huge problem. There's also too vague of broader generic classes, for example, it's impossible to write any generic functions for any numeric type, something that's possible in both Ada and F#.

Collapse
t4rzsan profile image
Jakob Christensen

Thanks, Patrick.

I am not sure I am smart enough to fully understand what you are saying. You ought to write a post on your points regarding generics in F# vs. C# 😉

Thread Thread
entomy profile image
Forem Open with the Forem app