Delphi's New Feature Desired: Native Tuple Types
Delphi's New Feature Desired: Native Tuple Types
Tuples are designed to hold a set of specific typed objects.
Tuples make it easy to pass around groups of values (for example a string and an Integer), store them in arrays or collections, even return multiple values from function calls.
The feature would may be used like below:
var t: tuple of (string, Integer, Boolean);
and you would can access individual members of the tuple using the strongly typed [] indexer operator:
s := t[0];
i := t[1];
where each index would be strongly typed, i.e. the compiler would know that t[0] is an string type, t[1] is an Integer type and so on.
You could also declare tuple literals using the new () syntax:
t := ('Holla', 23, False);
I am not a Embarcadero guy :D
Tuples are designed to hold a set of specific typed objects.
Tuples make it easy to pass around groups of values (for example a string and an Integer), store them in arrays or collections, even return multiple values from function calls.
The feature would may be used like below:
var t: tuple of (string, Integer, Boolean);
and you would can access individual members of the tuple using the strongly typed [] indexer operator:
s := t[0];
i := t[1];
where each index would be strongly typed, i.e. the compiler would know that t[0] is an string type, t[1] is an Integer type and so on.
You could also declare tuple literals using the new () syntax:
t := ('Holla', 23, False);
I am not a Embarcadero guy :D
Comments
Post a Comment