简体   繁体   English

Eiffel:如何获取过程的特定操作数的类型

[英]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? 正如我在调试器中看到的那样,可以获取操作数和过程名称,有没有办法获取它?

  • PROCEDURE=>operands returns a detachable that seems return the operands only when they have been setted into the agent PROCEDURE => operands返回一个可分离的对象,似乎仅在将它们设置到代理中时才返回它们
  • Do I have pass through any REFLECTOR class because the PROCEDURE class doesn't have this function and in this case why? 我是否通过了REFLECTOR类,因为PROCEDURE类没有此功能,在这种情况下为什么?

在此处输入图片说明

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: 评论:

  1. p.open_count gives the total number of open arguments. p.open_count给出打开参数的总数。
  2. p.generating_type retrieves the type of the routine object. p.generating_type检索例程对象的类型。
  3. p.generating_type.generic_parameter_type (1) retrieves the type of the open arguments tuple object. p.generating_type.generic_parameter_type (1)检索打开参数元组对象的类型。
  4. The final call to 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM