实施约束:class 功能 only_from_type 使用内联代理

Implementation contraint: The class feature only_from_type uses an inline agent

无法让代理进入 ensure class 例程背后是否存在语义,或者是当前编译器限制?

only_from_type (some_items: CHAIN[like Current]; a_type: detachable like {ENUMERATE}.measuring_point_type_generation): LINKED_LIST[like Current]
        -- extends Result with given some_items which are equal to given type
    do
        create Result.make
        across
            some_items is l_item
        loop
            check
                attached_type: attached l_item.type as l_type
            then
                if attached a_type as l_a_type and then l_type.is_equal (l_a_type) then
                    Result.extend (l_item)
                end
            end
        end
    ensure
        some_items.for_all (
            agent (an_item: like Current; a_type_2: detachable like {ENUMERATE}.measuring_point_type_generation) do
                if attached a_type_2 as l_type_2_a and then
                    attached an_item.type as l_item_type and then
                    l_item_type.is_equal (l_type_2_a)
                then
                    Result := True
                end
            end (a_type)
            )
        instance_free: Class
    end

给出以下错误

而且我觉得这里有错别字,不应该是Implementation constraint而不是contraint吗?

Error code: VUCR

Implementation contraint: The class feature only_from_type uses an inline agent.
What to do: Remove the inline agent from the code or make the feature a non-class one.
Class: MEASURING_POINT
Feature: only_from_type
Line: 183
        some_items.for_all (
->        agent (an_item: like Current; a_type_2: detachable like {ENUMERATE}.measuring_point_type_generation) do
            if attached a_type_2 as l_type_2_a and then

内联代理(如常规功能)采用隐式参数 - 当前对象。在 class 特征中(示例中使用它的地方),没有当前对象。因此,无法从 class 功能调用内联代理。

另一方面,可以检查代理是否不使用 Current,因此可以安全地使用 class 功能。报告错误的编译器没有实现这样的功能,而是报告实现约束错误。