Hacker News new | ask | show | jobs
by Rapzid 40 days ago
You can also do Memory<T> and Span<T> over unmanaged memory to make things.. Safer.
1 comments

Sure, but the point still stands versus using 100% raw C.

I only wish that the performance focus was there back in .NET 1.0, with the main architect coming from Delphi, but Microsoft had other priorities.

Also can we please have proper syntax for inline arrays instead of a special purpose attribute? Don't really get that one.

> Also can we please have proper syntax for inline arrays instead of a special purpose attribute? Don't really get that one.

While I kinda agree (And IMO ask whether having proper syntax would be a stepping stone to other things in future like proper alignment for 16-byte fields so we could sanely do cmpxchg16b), if I had to guess, it's because there's other existing code to handle StructLayoutAttribute, so just doing another attribute versus having a field probably was the 'easiest' way to implement across the different bits of the JIT and GC.

And that is how end up with stuff that Java has like @Overload instead of being a keyword,and other features that are annotation driven, instead of being language proper.

The excuse of breaking existing code doesn't even work, as there are other keywords that are context specific, and for those there was no problem introducing them.

By inline arrays do you mean within a struct field? You can do that with the `fixed` modifier.
Inline array is the safe version of unsafe fixed.