top | item 43257845

(no title)

veleek | 1 year ago

Can you help me understand your point of view a little bit more? I’ve been working for decades in C# professionally with a few stints in other languages and plenty of smaller side projects in any number of different ecosystems. I always find myself frustrated with “the experience” of working with many other languages. They all have their own pros and cons of course, but saying you don’t like the language because it doesn’t have sum types feels like saying you don’t like a Prius because it doesn’t have a pickup bed. Not a perfect analogy, but there are so many other features of C#’s type system that make it amazing to work with and it’s continually being improved year over year. I would be interested in knowing what types of things about the generics system you wish could be improved.

discuss

order

theusus|1 year ago

I find a need for specialisation at a lot of places and it simply doesn't exist in C#. Meta programming in C# almost everytime requires reflection which adds to uncertainty and compromises on readability. Other two are what I posted in original comments.

neonsunset|1 year ago

Struct generics in C# are monomorphized - exact same as in Rust.

Combine that with pattern matching and you can go quite far. In place of macros you can use source generators, although they are both weaker and stronger than proc macro depending on what you use them for.