A named tuple enables accessing the tuple items by name:
tuple_items: TUPLE [name: STRING; date: DATE; quantity: INTEGER]
Then, the feature use_it
simplifies to
io.put_string (tuple_items.name)
io.put_string (tuple_items.date.out)
At the moment, tuple item names cannot be used in an anchored type, so there is no way to specify the type of l_first
relative to the type of the tuple item. A workaround might be adding an anchor
name_anchor: STRING
require
is_callable: False
do
check from_precondition: False then end
end
and using it in anchored types, including the tuple declaration:
tuple_items: TUPLE [name: like name_anchor; date: DATE; quantity: INTEGER]
local
l_first: like name_anchor
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…