On Saturday, 16 January 2016 at 21:59:22 UTC, data pulverizer
wrote:
On Saturday, 16 January 2016 at 21:22:15 UTC, data pulverizer
wrote:
Is it possible to create a function that returns Type like
typeof() does? Something such as:
Type returnInt(){
return int;
}
More to the point what is the Type of a type such as int?
Thanks
p.s. I am aware I could do typeof(1) to return int, but I am
looking for something more elegant and some understanding.
Thanks for all the answers. I guess I have been writing a lot of
julia where I take creating arrays and tuples of types for
granted. In this case types are of type DataType. I am aware that
you can create tuples of types in D, but then it cannot be easily
manipulated e.g. (int, float)[0] = string or similar. You have to
immediately alias it and there are a limited number of operations
you can do with the resulting type. I guess the constraints are
that of a static language.