WinRT的原因不允许自定义泛型类型或接口 [英] WinRT reason for disallowing custom generic types or interfaces

查看:133
本文介绍了WinRT的原因不允许自定义泛型类型或接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里,并从构建甲板阅读的WinRT一点后,有人可以阐明具体的理由,导致他们从通过我们自己的IFoo<不允许我们光; T>,但他们是为了自己认可的通用接口类型?

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<T>, yet they do it for their own sanctioned generic interface types?

WinRT中必须有描述,解析,并通过通用的参数,或者一些解决这个奇特facading供自己使用的机制。

WinRT must have a mechanism for describing, resolving and passing generic arguments, or some fancy facading around this for their own use.

我无法想象扁平化的一些非通用的方式我的C#类工具库,我主要是想从C使用++而不是从JS这么多。

I can't imagine "flattening" some of my C# class utility libraries in non-generic fashion, which I mainly want to use from C++ and not so much from JS.

我要一流的智能感知和API的支持,就像你对你自己的MS类型的一样多。

I want first-class Intellisense and API support just as much as you do for your own MS types.

所以......为什么就不能我们使用表示机制呢?这是有可能被放宽以后允许或这是一个永久的限制?或者这是由于语言投影层自己定制处理特定泛型类型,而一些WinRT的集中式元处理常见的泛型类型?

So ... why can't we use said mechanism too? Is this likely to be relaxed and allowed later or is this a permanent restriction? Or is this due to the language projection layers themselves custom-handling specific generic types without some WinRT-centralized meta-handling common to any generic type?

感谢。

推荐答案

在幕后,因为预计为IXxx的类型是由所谓的参数接口或pinterfaces执行。每种语言投影知道如何表达在天然的和熟悉的方式内置的参数接口 - 例如,IMAP参数接口由CLR作为IDictionary的投影

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.

语言的预测(尤其是JS)不知道做什么用自定义的参数接口做的,所以他们不允许的。

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

有没有办法知道,如果这种限制会在未来放宽,因为没有知道什么功能将被添加到Windows在未来的道路。

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.

这篇关于WinRT的原因不允许自定义泛型类型或接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆