[nem-en] void as type parameter

Sandro Magi smagi at higherlogics.com
Sun Jul 1 18:26:21 CEST 2007


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



More information about the devel-en mailing list