hasParameterType(TypeInfo)
hasParameterType()所属R语言包:TypeInfo
Functions to query existence of specific type information
功能查询特定类型的信息存在
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These functions and the associated methods are used to determine if a function has type specification for any of the parameters and also for the return type. These are used when rewriting the body of the function to support type checking (see rewriteTypeCheck). We use these predicate functions to determine if we have information about any parameter types and if not we do not add a check of the arguments (i.e. a call to checkArgs). Similarly, we determine if we have any information about the return type before adding a call to checkReturnValue.
这些功能和相关的方法被用来确定的功能,如果有任何参数和返回类型的类型规范。这些都是用来重写时身体的功能,支持类型检查(见rewriteTypeCheck)。我们使用这些谓词函数,以确定是否有任何类型的参数的信息,如果没有,我们不加参数的检查(即调用checkArgs)。同样,我们判断,如果我们有任何关于返回类型的信息,前调用checkReturnValue加入。
They are used internally. They are exported in order to make them available for others to use in providing alternatives to this prototype implementation and also to overcome an anomoly in the callNextMethod() mechanism that appears to disappear when the generic is exported from the NAMESPACE.
他们在内部使用。他们出口,以使他们可以为他人使用这个原型的实现提供替代,也克服callNextMethod()机制,似乎消失时,通用从命名空间导出anomoly。
用法----------Usage----------
hasParameterType(def)
参数----------Arguments----------
参数:def
the object which is to be queried. This can be a function or a TypeSpecification-class instance which is typically extracted from the function. Generally, a user would pass the function to the function call and the resulting sequence of recursive method calls will occur.
是要查询的对象。这可以是一个函数或一个TypeSpecification-class实例,通常是从提取的功能。一般来说,用户将通过函数调用的函数和递归方法调用序列会发生。
值----------Value----------
A logical value indicating if the object def “has” the relevant facet/property.
一个逻辑值,表示如果对象def“有”的有关面/财产。
作者(S)----------Author(s)----------
Duncan Temple Lang <duncan@wald.ucdavis.edu>
参见----------See Also----------
rewriteTypeCheck checkArgs checkReturnValue
rewriteTypeCheckcheckArgscheckReturnValue
举例----------Examples----------
hasReturnType(SimultaneousTypeSpecification(
TypedSignature(x="integer", returnType = "duncan")))
# FALSE[假]
hasReturnType(SimultaneousTypeSpecification(TypedSignature(x="integer")))
# TRUE[真]
hasReturnType(SimultaneousTypeSpecification(returnType = "duncan"))
# TRUE[真]
hasReturnType(ReturnTypeSpecification("duncan"))
hasReturnType(IndependentTypeSpecification(x = c("integer", "logical"),
y = "character",
returnType = "duncan"))
hasReturnType(IndependentTypeSpecification(x = c("integer", "logical"),
y = "character"))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|