Expressions-->Member lookup
7.4 Member lookup
在word文档的第140页
A member lookup is the process whereby凭借;通过…;借以;与…一致 the meaning of a name in the context of a type is determined.
A member lookup can occur as part of evaluating评估 a simple-name (§7.6.2) or a member-access (§7.6.4) in an expression.
If the simple-name or member-access occurs as the primary-expression of an invocation-expression (§7.6.5.1), the member is said to be invoked.
If a member is a method or event, or if it is a constant常量, field or property of either a delegate type (§15) or the type dynamic (§4.7), then the member is said to be invocable.
Member lookup considers not only the name of a member but also the number of type parameters the member has and whether the member is accessible.
For the purposes of member lookup, generic methods and nested generic types have the number of type parameters indicated in their respective declarations and all other members have zero type parameters.
A member lookup of a name N with K type parameters in a type T is processed as follows:
First, a set of accessible members named N is determined:
If T is a type parameter, then the set is the union of the sets of accessible members named N in each of the types specified as a primary constraint or secondary constraint (§10.1.5) for T, along with the set of accessible members named N in object.
Otherwise, the set consists of all accessible (§3.5) members named N in T, including inherited members and the accessible members named N in object. If T is a constructed type, the set of members is obtained by substituting type arguments as described in §10.3.2. Members that include an override modifier are excluded from the set.
Next, if K is zero, all nested types whose declarations include type parameters are removed. If K is not zero, all members with a different number of type parameters are removed. Note that when K is zero, methods having type parameters are not removed, since the type inference process (§7.5.2) might be able to infer the type arguments.
Next, if the member is invoked, all non-invocable members are removed from the set.
Next, members that are hidden by other members are removed from the set. For every member S.M in the set, where S is the type in which the member M is declared, the following rules are applied:
If M is a constant, field, property, event, or enumeration member, then all members declared in a base type of S are removed from the set.
If M is a type declaration, then all non-types declared in a base type of S are removed from the set, and all type declarations with the same number of type parameters as M declared in a base type of S are removed from the set.
If M is a method, then all non-method members declared in a base type of S are removed from the set.
Next, interface members that are hidden by class members are removed from the set. This step only has an effect if T is a type parameter and T has both an effective base class other than objectand a non-empty effective interface set (§10.1.5). For every member S.M in the set, where S is the type in which the member M is declared, the following rules are applied if S is a class declaration other than object:
If M is a constant, field, property, event, enumeration member, or type declaration, then all members declared in an interface declaration are removed from the set.
If M is a method, then all non-method members declared in an interface declaration are removed from the set, and all methods with the same signature as M declared in an interface declaration are removed from the set.
Finally, having removed hidden members, the result of the lookup is determined:
If the set consists of a single member that is not a method, then this member is the result of the lookup.
Otherwise, if the set contains only methods, then this group of methods is the result of the lookup.
Otherwise, the lookup is ambiguous, and a binding-time error occurs.
For member lookups in types other than type parameters and interfaces, and member lookups in interfaces that are strictly single-inheritance (each interface in the inheritance chain has exactly zero or one direct base interface), the effect of the lookup rules is simply that derived members hide base members with the same name or signature. Such single-inheritance lookups are never ambiguous. The ambiguities that can possibly arise from member lookups in multiple-inheritance interfaces are described in §13.2.5.
invocable
Alternative spelling of invokable.
(computing) That can be invoked; callable.
Origin
invoke + -able
Expressions-->Member lookup的更多相关文章
- SWift中 '?' must be followed by a call, member lookup, or subscript 错误解决方案
那是因为你在使用自己写的分类时没有指定返回的数据类型 指定下返回数据类型就好了 我是用的oc写的分类在Swift中使用的 错误代码 private lazy var btn = UIButton.C ...
- Unqualified name lookup
Unqualified name lookup File scope Namespace scope For an qualified name, that is a name that does n ...
- new Modifier (C# Reference)
https://msdn.microsoft.com/en-us/library/435f1dw2.aspx When used as a declaration modifier, the new ...
- wpf样式绑定 行为绑定 事件关联 路由事件实例
代码说明:我要实现一个这样的功能 有三个window窗口 每个窗体有一个label标签 当我修改三个label标签中任意一个字体颜色的时候 其他的label标签字体颜色也变化 首先三个窗体不用 ...
- Swift5 语言参考(七) 属性
属性提供有关声明或类型的更多信息.Swift中有两种属性,即适用于声明的属性和适用于类型的属性. 您可以通过编写@符号后跟属性的名称以及属性接受的任何参数来指定属性: @attribute name ...
- swift中,Optional、?与!之间的关系
swift中,Optional.?与!之间的关系 Optional <ClassName> 与 ClassName? 等价 对 ClassName! 强制取值会导致崩溃(如果对象为nil时 ...
- swift 注解 (和java比照)@attribute name
Attributes provide more information about a declaration or type. There are two kinds of attributes i ...
- Swift 3到5.1新特性整理
本文转载自:https://hicc.me/whats-new-in-swift-3-to-5-1/,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有. Hipo 2.0 重写从 Swif ...
- 类型检查和鸭子类型 Duck typing in computer programming is an application of the duck test 鸭子测试 鸭子类型 指示编译器将类的类型检查安排在运行时而不是编译时 type checking can be specified to occur at run time rather than compile time.
Go所提供的面向对象功能十分简洁,但却兼具了类型检查和鸭子类型两者的有点,这是何等优秀的设计啊! Duck typing in computer programming is an applicati ...
随机推荐
- django在验证登录页面时遇到的数据查询问题
数据库查询时针对不存在的用户名进行验证 django在查询数据库时,可以使用get和filter两种方法. 两者的区别 当数据库内不存在该数据时,get会返回异常,而filter会返回空. 当数据库内 ...
- (转载)不错的CSS写法
根据微信订阅号“设计达人”推送的文章,学到了如题知识.个人尝试了一下,感觉还不错.原文链接:http://mp.weixin.qq.com/s/g9TyBwB9xIi45TGwTBOLSQ. 字体 从 ...
- NOIP 前的垂死挣扎
计划每天十题吧,可能会一天水题一天难题吧.题目以杂题为主,没有专题可言. 10.11 计划: [x] P2939 [USACO09FEB] 改造路 Revamping Trails [ ] P3601 ...
- 杂文Python
2.文件操作 文件操作的过程:打开文件获得句柄——>操作文件行(遍历等)——>关闭文件 打开文件获得句柄 比较low的方法: f = open("file_path", ...
- Python学习:ModuleNotFoundError: No module named 'pygal.i18n' 的解决方法
最近在学<Python编程:从入门到实践>,16.2小结中 from pygal.i18n import COUNTRIES 获取两个字母的国别码,我用的pygal的版本是2.4.0(终端 ...
- 【Codeforces 489D】Unbearable Controversy of Being
[链接] 我是链接,点我呀:) [题意] 让你找到(a,b,c,d)的个数 这4个点之间有4条边有向边 (a,b)(b,c) (a,d)(d,c) 即有两条从a到b的路径,且这两条路径分别经过b和d到 ...
- java增强for循环中获取index
java增强for循环中获取index http://rensanning.iteye.com/blog/2003205
- Remmarguts’ Date(poj 2449)
求第k短路的长度,如果没有,输出-1. /* k短路模板 注意当s=t时,k++. */ #include<iostream> #include<cstdio> #includ ...
- java虚拟机(一)-java内存区域与内存溢出异常
1.简述:java虚拟机在执行java程序的过程中,会把他所管理的内存分为以下几个区域, 1.1.程序计数器 1.2.虚拟机栈 1.3.本地方法栈 1.4.java堆 1.5.方法区 如图所示: 2. ...
- 欧拉回路输出(DFS,不用回溯!)Watchcow POJ 2230
Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 8109 Accepted: 3551 Special Judge D ...