Discovering late (used to define classes instead) TUPLES and looking through the documentation I was wondering if there is a mechanism to get the right type of a given TUPLE
.
The goal is both anchoring its types and avoid having to test its type before getting an item.
Is there a language mechanism?
I also found few documentation about them, maybe I'm not looking at the right place.
For the following code I'd like to tell like tuple_items.types[1]
and tuple_items.typed_item (1)
use_it
do
if attached {STRING} tuple_items.item (1) as l_tuple_item_1 then
io.put_string (l_tuple_item_1)
end
if attached {DATE} tuple_items.item (1) as l_tuple_item_2 then
io.put_string (l_tuple_item_2.out)
end
- ...
end
tuple_items: TUPLE[STRING, DATE, INTEGER]
local
l_first: STRING -- like tuple_items.first?
do
Result := [l_first, create {DATE}.make_now, 1]
end