On Thu, Aug 29, 2013 at 4:29 AM, Bennie Kloosteman <[email protected]>wrote:
> While fixed arrays can be created now they are not that flexible
>
> A few questions here how will this be created ?
>
Do you mean syntactically? You could use essentially the same syntax that
is currently used for C# arrays as they are.
> If you want to use strings like C# with the char[] embeded in the string
> object you need some mechaism to tell the CLR the size ..
>
Yes. Actually, what you really want here is a Nat kind, so you end up with
something like
class FixedString<N> where N :: Nat {
char payload[N];
}
after which you can write FixedString<5>.
and the compiler can create a subtype...
>
It isn't a subtype. It's an instantiation of a generic type.
> 1. What is the impact of all these sub types ?
>
There is no major impact to having lots of instantiations. The main issue
you aren't considering (yet) is that there will be various functions that
operate on FixedStrings, and some thought is required to avoid
instantiating these over and over. There are a number of ways to solve that.
> 2. I asume typeof( FastString5) != typeof(FastString6) .
>
Correct. This is true for the same reason that typeof(List<char>) !=
typeof(List<Int32>)
> 3.What about cases where the length is not known at compile time ..
>
Then you can't use a FIxedString.
> 4. The same would for NAT types ? it ).
>
Umm. Not sure what the question was here...
shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev