[nem-en] void as type parameter
Michal Moskal
michal.moskal at gmail.com
Tue Jul 3 12:35:06 CEST 2007
One can as well use Object and pass null. I guess the overhead would
be similar. This is actually what we have done some time ago, but I
guess there were some cases where it didn't work, so Dimitry comitted
a patch to just disallow it. Investigating this further is on my TODO
list, but it somehow cannot get to the top...
On 7/1/07, Sandro Magi <smagi at higherlogics.com> wrote:
> 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
> >>
> >
> >
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
--
Michał
More information about the devel-en
mailing list