We can actually do it easier with existing language features. The following is valid:
val (
status,
totalSharesReserved,
totalSharesTransacted,
totalShares,
sharePrice,
minTransactionAmount
) = offering.run { Tupple6(status,
totalSharesReserved,
totalSharesTransacted,
totalShares,
sharePrice,
minTransactionAmount) }
Where Tupple6
is a simple tuple with 6 elements. Of course it would be possible to use some functions to make it somewhat tidier. Note that this code doesn’t have position issues. If you repeat this frequently for the same type, you can of course write a specific function to make it more elegant.