0

试图解决其中一个 SCOOP 后果,make_from_separate我遇到了一个问题,即在运行时类型似乎相同并且不会通过attached语句。

non_separate_from_any

non_separate_from_any, any_from_separate (v: separate ANY): ANY
    local
        l_array: ARRAY[detachable ANY]
        l_res_ll_arr_det_any: LINKED_LIST[ARRAY[detachable ANY]]
        l_arr_det_str: ARRAY[detachable STRING]
    do
        if
            attached {REAL} v as l_v
        then
            Result := l_v
        elseif attached {separate INTEGER_32_REF} v as l_v then
            Result := l_v.as_integer_32
        elseif attached {INTEGER} v as l_v then
            Result := l_v
        elseif attached {separate STRING} v as l_v then
            create {STRING} Result.make_from_separate (l_v)
        elseif attached {separate STRING_32} v as l_v then
            create {STRING_32} Result.make_from_separate (l_v)
        elseif attached {separate LINKED_LIST[separate ARRAY[detachable ANY]]} v as l_v then
            create l_res_ll_arr_det_any.make
            across
                l_v is l_list_item_sep
            loop
                create l_array.make_empty
                separate l_list_item_sep as l_list_item_sep_tmp do
                    across
                        l_list_item_sep_tmp as l_array_item_non_sep
                    loop
                        if attached l_array_item_non_sep as l_any_sep then
                            l_array.put (non_separate_from_any (l_any_sep), l_array_item_non_sep.cursor_index)
                        else
                            l_array.put (Void, l_array_item_non_sep.cursor_index)
                        end
                    end
                end
                l_res_ll_arr_det_any.extend (l_array)
            end
            Result := l_res_ll_arr_det_any
        elseif attached {separate ARRAY[detachable STRING]} v as l_v then
            create l_arr_det_str.make_empty
            across
                l_v as l_s_sep
            loop
                if attached l_s_sep.item as l_s_sep_att then
                    l_arr_det_str.put (create {STRING}.make_from_separate (l_s_sep_att), l_s_sep.cursor_index)
                else
                    l_arr_det_str.put (Void, l_s_sep.cursor_index)
                end
            end
            Result := l_arr_det_str
        else
            check
                implement_me: False
            then
                do_nothing
            end
        end
    ensure
        instance_free: Class
    end

带截图的变量和语句

埃菲尔工作室截图

安慰出来

更新 20200616

声明如下:

DB_TUPLE_COL_NAMES -> items: ARRAY[STRING]
DEFAULT_DB_ACTION -> column_names: separate like {DB_TUPLE_COL_NAMES}.items


DEFAULT_DB_ACTION -> make_from_separate (other: separate like Current)

在运行时我得到了一个other.column_names -> at runtime: ARRAY[detachable STRING]

这个怎么可能!!!这就是我实施any_from_separatewith的原因l_arr_det_str 在此处输入图像描述

4

2 回答 2

1

看起来对象的实际类型是ARRAY [detachable STRING]而不是ARRAY [STRING].

于 2020-06-16T07:14:37.017 回答
0

TL;博士:

改变

        elseif attached {separate LINKED_LIST[separate ARRAY[detachable ANY]]} v as l_v then
            create ll_arr_det_any.make -- l_arr_det_str: ARRAY[detachable STRING]

        elseif attached {separate LINKED_LIST[separate ARRAY[detachable ANY]]} v as l_v then
            create l_arr_str.make -- l_arr_det_str: ARRAY[STRING]

解释

我的错误是进入{SCOOP_UTIL}.any_from_separate.

作为

{separate LINKED_LIST[separate ARRAY[ANY]]}

符合

{separate LINKED_LIST[separate ARRAY[detachable ANY]]}

它正在走这条路,我解释说我必须创建一个

ARRAY[detachable ANY]但是是一个ARRAY[ANY]

于 2020-06-16T17:34:45.920 回答