试图解决其中一个 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]