Timeline for Generics in low level languages
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 3, 2014 at 20:51 | comment | added | Konrad Morawski | @PeteKirkham maybe it's my English, but to me it doesn't mean that type information is erased at all. Specialized generic type is created, and then it is reused. How could Stack<int> be ever reused if the <int> bit wasn't preserved? I'm tempted to post this as a question. | |
| Nov 3, 2014 at 16:26 | comment | added | Pete Kirkham | @KonradMorawski the specialisation is preserved in the reflected type information, but for generating code the behaviour is to erase the type - The first time a generic type is constructed with any reference type, the runtime creates a specialized generic type with object references substituted for the parameters in the MSIL. Then, every time that a constructed type is instantiated with a reference type as its parameter, regardless of what type it is, the runtime reuses the previously created specialized version ... msdn.microsoft.com/en-us/library/f4a6ta2h.aspx | |
| Nov 2, 2014 at 18:01 | comment | added | Konrad Morawski | @PeteKirkham C# doesn't use type erasure. Type information is persisted in run time. | |
| Nov 2, 2014 at 14:38 | comment | added | Pete Kirkham | C# does both ( type erasure for classes, instantiation for value types) so it's not a binary choice. | |
| Nov 2, 2014 at 14:20 | history | answered | ratchet freak | CC BY-SA 3.0 |