WinRT reason for disallowing custom generic types or interfaces

前端 未结 2 2075
北海茫月
北海茫月 2021-01-03 08:06

After reading about WinRT a bit here and from Build decks, can someone shed light on the specific rationale that lead them to disallow us from passing our own IFoo, ye

2条回答
  •  春和景丽
    2021-01-03 08:37

    Under the covers, the types which are projected as IXxx are implemented by what are called "parameterized interfaces" or "pinterfaces". Each language projection knows how to express the built-in parameterized interfaces in a natural and familiar fashion - for example, the IMap parameterized interface is projected by the CLR as IDictionary.

    The language projections (especially JS) don't know what to do with custom parameterized interfaces, so they're not allowed.

    There's no way of knowing if this restriction will be relaxed in the future, because there is no way of knowing what features will be added to Windows in the future.

提交回复
热议问题