Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

winmd is limited to the .NET type system - an improvement over C, but still insufficiently expressive enough imo.

I suppose you could hack it by adding new Attributes...



See: https://github.com/microsoft/win32metadata#winmd-emitter-ove...

It seems at least one of their hacks is not valid in the CLR, so that bridge has been crossed. Plus they do make use of attributes.


I think this C# intermediate is just a tooling thing. The winmd format is already extended beyond .NET IMHO.

And I think, they have thought about that before they startet :)


Some things aren’t expressable in winmd though - like Code Contracts’ preconditions, invariants, and postconditions: those require directly executable (but pure, stateless, and side-effect-free) methods to represent and encode those contracts. As Winmd binaries can’t contain executable code it means you’re limited to only using “common”/“known” contract functions and/or resorting to re-encoding the contract to a string containing the expression that’s stored in an attribute. Good luck with that.


Who does still use Code Contracts besides legacy code? They have been long dead.


I was only using it as an example of a concept that isn't well-representable in winmd.

As for CC specifically, I'd love to use it with .NET Core - I gather it doesn't need that much work to get going again. It's a shame Microsoft hasn't invested more into it, especially as there was talk of making CC an integral part of the C# syntax (as in, first-class support for `pure` functions in C# and a succinct syntax for attaching them as invariants/etc to C# types and methods). If this was done it would solve so many problems (e.g. compiler-enforced guarantees about which navigation-properties on Entity Framework entities are loaded) and maybe even elevate C# to compete with Ada and Eiffel for safety-critical systems!


Requiring VS Enterprise to actually use them properly, doomed their adoption.


WinRT/UAP/UWP (got to love marketing) is just COM as usual, with winmd instead of type libraries, IInspectable as base interface alongside IUnknown and extended ABI for generics, enums, arrays, structs.

Here is a nice overview of the whole story and how interrelated COM and .NET are.

https://arstechnica.com/features/2012/10/windows-8-and-winrt...




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

Search: