Hacker News new | past | comments | ask | show | jobs | submit login

Except it is true because structs are often frowned on, and plenty of things end up as reference types. And arrays are reference types too, so things like string.split have no workaround. Also note that until v4 or so, the CLR had limitations optimizing methods using structs.

But yes, the CLR has a far superior design and can avoid some of Java's pitfalls.




>structs are often frowned on

Only in the premature optimization sense, and "familiarity with new programmers" sense. There's nothing wrong with using structs. In fact, XNA and many other game programming libraries do use structs to represent position vectors, which is the context of this article.

>And arrays are reference types too, so things like string.split have no workaround.

If you're okay with going unsafe, arrays can be stackalloc'd.


Anyone writing Minecraft in C# would use a struct for the position vector. There's no good reason to frown upon it in this case.


It's not C#, but here's Minecraft in C++ and Lua: https://github.com/minetest/minetest


This is a cultural problem. We use structs all over the place in Roslyn. You need to train your developers on how to appropriately use the features available to them on the platform.


Structs are frowned upon? Since when?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: