Re: Function minimization and random numbers
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Wed, 6 Feb 2008 18:47:07 -0000
Jon Harrop <usenet@xxxxxxxxxxxxxx> wrote:
In what way does C# lack closures? It supports them in the form of
delegates with captured variables etc. It may not be the same form that
F# uses, but that's not the same thing.
Closures represent all functions but .NET delegates do not because .NET
draws an unnecessary distinction between members and delegates, making them
incompatible. C# inherits this but F# goes to great lengths to remove this
artificial distinction.
It seems to me like *you're* making the artificial distinction here.
You can build closures in C# just fine according to every definition of
closure I've seen.
That's not to say that you can use every member *as* a closure, but to
me that's not the same thing at all. Claiming that C# lacks closures is
pure FUD in my view.
You could turn everything into a delegate but, of course, this would not be
an alluring interface for C# users.
To provide first-class closures, .NET (or C#) might replace all members with
properties that return delegates. Then you could say "C# supports
first-class closures".
No, then you could say "C# supports first-class closures in the same
way that F# does". Can you find a generic computer science definition
of closures that C#'s support doesn't fulfil?
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
.
- Follow-Ups:
- Re: Function minimization and random numbers
- From: Jon Harrop
- Re: Function minimization and random numbers
- References:
- Re: Function minimization and random numbers
- From: Jon Harrop
- Re: Function minimization and random numbers
- From: Marc Gravell
- Re: Function minimization and random numbers
- From: Jon Harrop
- Re: Function minimization and random numbers
- From: Marc Gravell
- Re: Function minimization and random numbers
- From: Jon Harrop
- Re: Function minimization and random numbers
- From: Jon Skeet [C# MVP]
- Re: Function minimization and random numbers
- From: Jon Harrop
- Re: Function minimization and random numbers
- Prev by Date: Re: bytes To Hex
- Next by Date: Re: Convert DateTime.Now() to SQL Server(tm) standard internal format for datetime
- Previous by thread: Re: Function minimization and random numbers
- Next by thread: Re: Function minimization and random numbers
- Index(es):
Relevant Pages
|