compiler support added for precise GC

Steven Schveighoffer schveiguy at yahoo.com
Wed Apr 18 10:36:00 PDT 2012


On Wed, 18 Apr 2012 13:18:20 -0400, Robert Clipsham  
<robert at octarineparrot.com> wrote:

> On 18/04/2012 17:31, Jacob Carlborg wrote:
>> On 2012-04-18 13:06, Steven Schveighoffer wrote:
>>> On Tue, 17 Apr 2012 02:50:02 -0400, Jacob Carlborg <doob at me.com> wrote:
>>
>>> Can you explain why .NET types are not by default serializable? All of
>>> them have full runtime reflection AFAIK.
>>>
>>> I'm not using that as an argument, I'm genuinely interested.
>>
>> I'm wondering that as well.
>>
>
>  From my quick google I couldn't find a definitive answer, but:
>
> http://stackoverflow.com/questions/4408909/why-classes-are-not-serializable-by-default-in-net
>
> http://en.wikipedia.org/wiki/Serialization (reasons listed under Java)

I think those answer the question quite well.

In summary, just because you *can* serialize a type doesn't mean you  
*should*, and the risks of serializing something that shouldn't be  
serialized trumps the convenience of not having to mark it.  The latter  
part is really a subjective statement, but I would agree with it.

I bet part of the confusion comes from the fact that such attributes are  
named "Serializable", whereas pretty much anything is serializable.  It  
should be something more along the lines of "AllowSerialization"

-Steve


More information about the Digitalmars-d mailing list