[nem-en] void as type parameter

Sandro Magi smagi at higherlogics.com
Sun Jul 1 18:40:08 CEST 2007


Yes, which is why I just created the empty "Unit" struct as a
pseudo-void type to fake it. :-)

Sandro

Kamil Skalski wrote:
> Well, last time we checked .NET 2.0 verifier complained that void
> cannot be used as generic argument. I guess it also failed in runtime
> if one used that.
> 
> See
> http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=94226
> 
> 
> 2007/7/1, Sandro Magi <smagi at higherlogics.com>:
>> Dmitry Ivankov wrote:
>> > Hi
>> >
>> > On 7/1/07, *Elifant* <elifantu at mail.ru <mailto:elifantu at mail.ru>>
>> wrote:
>> >
>> >     I know that 'void' was disabled to be used as type parameter
>> some time
>> >     ago. But I can't find
>> >     corresponding discussion. Can you give me a link?
>> >
>> > It's just because current .Net denies void as parameter.
>> > And so we have separate internal function types for void cases :(
>> >
>> > Don't know if there was discussion earlier..
>> > Maybe it is a good idea to have some standard pseudo void type.
>>
>> This works well actually, and I use it in my FP# library where I have
>> Unit as an empty struct:
>>
>> http://fpsharp.svn.sourceforge.net/viewvc/fpsharp/trunk/FP.Types/Unit.cs?view=markup
>>
>>
>> The JIT should be able to optimize this somewhat, but I haven't
>> performed any benchmarks to test the costs.
>>
>> Sandro
>>
>> _______________________________________________
>> https://nemerle.org/mailman/listinfo/devel-en
>>
> 
> 




More information about the devel-en mailing list