I was wondering if there are any languages that allow for named tuples. Ie: an object with multiple variables of different type and configurable name.
Eg:
public NamedTuple<double:Speed, int:Distance> CalculateStuff(int arg1, int arg2)
var result = CalculateStuffTuple(1,2);
Console.WriteLine("Speed is: " + result.Speed.ToString())
Console.WriteLine("Distance is: " + result.Distance.ToString())
I could conceive how a dynamic could support such a feature. The static languages I usually swim in (like c#) can do a Dictionary, but that's not type safe unless all items are of the same type. Or you can use a Tuple type, but that means you have fixed names of the members (Var1, Var2, etc).
You could also write a small custom class, but that's the situation I'd like to avoid.
I could imagine a macro processing language could script something like that up for you in a static language, but I don't know of such a language.
This comes out of my answer from this question about return types.