>I think you are referring to the pun between System.char and char. If so,
note that System.char is a descendant of System.ValueType. That is: it's a
structure, not a class. No marshal tricks are required to embed it; all of
that is a consequence of it being a struct.
 

Was referring to arrays are reference types but can be marshalled as value
types or pinned value types.   Correct on the embedded array hack requiring
fixed sized not immutability   . 

 

>But in fact the specification does not guarantee this implementation, and
with good reason. They were well aware that incremental real-time GC might
require a chunked implementation of both vectors and characters.

 

This is correct but would break interop ( which returns a pointer) and hence
backward compatibility so for  windows wrongly .NET it won't be changing.

 

 

> Because one has to pin multiple objects. Granted they are primitive, but
it's a special case.
 

Not a big deal .

 

>I haven't thought it through, but probably not. Strands *can't* be part of
the externally visible String specification, so they aren't first-class
objects. In light of which it probably makes sense to put the tag bits into
the referencing pointer within the string object.

 

They can still be first class and  private/friend  to the string class or
internal or BitCs equivalent .

>>Especially for a compacting collector basically all strands are pinned...


>What! Not at all. For any relocating collector strands are relocatable like
anything else in the heap. That's the *problem*.
 

>P/Invoke itself wasn't bad. What got added to deal with the COM object
model was a nightmare, and in my opinion not well thought out. >OTOH, COM
support was likely to be a nightmare no matter what one did.

 

Was referring to all strands in the tree of a particular string  being fixed
not all of them.. The funny thing with COM was very few people outside the
.NET devs used com most rewrite or wrap com in SOA style services.

 

> Chris Brumme once told me that conventional arrays had been planned for
CLR 1.0, got dropped for schedule reasons, and never got revisited.

 

Pretty sad would be nice for sys development and interop . They are sort of
there  but some required generics , after 2.0 only as fixed byte[]  (
introduced in 2.0 ) or as strings. 

 

Eg  this ok but , the pinning and allocation you need to do yourself so not
a first class citicen though after 2.0 you can use stacalloc 

 

[StructLayout(LayoutKind.Sequential, Size=TotalBytesInStruct),Serializable] 

public struct LPRData 

{ 

/// char[15] 

[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 15)] 

public string data; 

 

/// int[15] 

[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15)] 

public int[] prob; 

} 

 

 

Ben

 

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to