[英]Eiffel: how do I get the type of a particular operand of a procedure
As I can see into the debugger it's possible to get the operands, and name of procedure, is there a way to get it? 正如我在调试器中看到的那样,可以获取操作数和过程名称,有没有办法获取它?
Seems that estudio has access to informations as ROUTINE client don't have, why is he a privileged one? 似乎estudio可以像ROUTINE客户端那样访问信息,为什么他是特权用户? is he cheating?
他在作弊吗?
The following code demonstrates how to retrieve information about open argument types of a routine object: 以下代码演示了如何检索有关例程对象的开放参数类型的信息:
p: ROUTINE -- Routine object.
t: TYPE [detachable ANY] -- Current open argument type.
do
p := agent (i: INTEGER; s: STRING)
do
end
across
1 |..| p.open_count as i
loop
t := p.generating_type.generic_parameter_type (1).generic_parameter_type (i.item)
io.put_string (t.name)
io.put_new_line
end
For me, the code above prints 对我来说,上面的代码可以打印
INTEGER_32
!STRING_8
Comments: 评论:
p.open_count
gives the total number of open arguments. p.open_count
给出打开参数的总数。 p.generating_type
retrieves the type of the routine object. p.generating_type
检索例程对象的类型。 p.generating_type.generic_parameter_type (1)
retrieves the type of the open arguments tuple object. p.generating_type.generic_parameter_type (1)
检索打开参数元组对象的类型。 generating_type
retrieves the type of the open argument with index i.item
. generating_type
检索与指数开参数的类型i.item
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.