The ideal would be something like (for an ini parser I’m playing with):
sortdef loc_and_count = @{ loc = addr, count = int }
vtypedef sized_array (a:t@ype, lc:loc_and_count) = (@[a][lc.count]@[lc.loc]|@{ sz = int(lc.count), addr = ptr(lc.loc) })
vtypedef ini_entry (section_lc: loc_and_count, key_lc: loc_and_count, value_lc: loc_and_count) = @{ section=sized_array(section_lc), key=sized_array(key_lc), value=sized_array(value_lc) }
Without records in the statics, something like this would be nice:
datasort loc_and_count = loc_and_count of (addr, int)
vtypedef sized_array (a:t@ype, lc:loc_and_count) = case lc of (l, i) -> (@[a][i]@[l]|@{ sz = int(i), addr = ptr(l) })
vtypedef ini_entry (section_lc: loc_and_count, key_lc: loc_and_count, value_lc: loc_and_count) = @{ section=sized_array(section_lc), key=sized_array(key_lc), value=sized_array(value_lc) }
These are of course just conveniences, but as it stands I need to name every static variable repeatedly.
Thanks,
Shea