When I study the internal CLI functions, I notice that a type signature can indicate the boundaries of an array (at compile time). For example, instead of having:
Byte[,]
We can have:
Byte[1...100,1...]
If I am not mistaken, it is impossible to actually declare types such as the latter in C # or C ++ / CLI. In addition, ECMA-335 indicates:
VES creates one array type for each recognized array type. In general, array types differ only in the type of their elements and their rank.
The common language specification (CLS) imposes a number of limitations, including:
Only the fact that the element is an array, and the type of the element of the array should be required to distinguish between overloads.
So it seems that compile-time array border support is present at the lowest CLI levels, but not elsewhere. This makes me wonder:
When will a type signature that includes this information be created or meet? Are there .NET languages ββthat emit this? EDIT: There are languages ββthat probably usually use disposable arrays, but do they encode this in type labels?
Where does the CLI use this information, if present? (This, in particular, is of interest to me as I am developing a CLI implementation.)
As far as I can tell, any array is created either using the newarr bytecode instruction for vectors, or Array.CreateInstance for the general case. None of these mechanisms accept a type signature for the array itself, so the creation does not seem to be able to use this information.
Theoretically, this information may be useful for optimizing access to an array by embedding efficient machine code to calculate the address. However, ldelem and friends only access simple vectors; multidimensional array access requires a method call, which makes me think that such an optimization is likely to fail.
I need to think that for this mechanism there is a definite goal, so that it becomes an international standard, but I do not see this.
Kevin
source share