Re: Function minimization and random numbers

Tech-Archive recommends: Speed Up your PC by fixing your registry



Marc Gravell wrote:
C#'s type system makes the distinction, not me.

minor point, but surely the CLR spec defines the type system, not the
language

If that were true then F# would suffer the same fate as C# but it doesn't.
Indeed, this is a Turing argument: you can wrap anything up in the CLR so
it doesn't actually impose anything on your type system.

That is not how F# supports closures.
OK, I'm *really, really* struggling to see the difference, and I am
genuinely interested (heck, I went to the F# lectures at TechEd...);
can you please explain to me what the F# closures do that isn't easily
achievable in C#. Your point about having to manually translate simply
doesn't work for me, since naming a method to use as a Func [etc]
doesn't strike me as odiously manual; of course a lambda is just as
easy and probably closer to what we are talking about...

No. My point is that F# requires no code whatsoever to do the same thing. No
lambda, nothing. You look at a member invocation:

foo.Bar(3)

and say "I want that Bar member as a closure" and you just write:

foo.Bar

to get it. That's it. All done. That is a functional value. You can't even
tell that it came from a member rather than a delegate.

However, that doesn't express just how important it is to remove this
artificial distinction. Until you do that, you're delegates will only ever
be second-class closures because you cannot manipulate all functions in the
same way: you need to know how the function was defined.

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?u
.



Relevant Pages

  • Re: Design Patterns and Functional programming
    ... Ada doesn't support closures. ... ad-hoc chimeras like Boolean | Rubbish. ... SML's type system is decideable and Haskell's is not. ... access x n Integer is a member of the class without evaluation of Pi. ...
    (comp.object)
  • Re: Function minimization and random numbers
    ... Well, .NET's type system makes the distinction, allowing conversions ... Groovy supports overloaded method groups as closures, ... Consider a language that support integers but imposes a compile time ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Design Patterns and Functional programming
    ... If you mean a programming style heavily relying on closures, then yes, ... This is why OOP can be integrated into functional languages. ... Yet a consistent type system would be able to describe either. ...
    (comp.object)
  • Re: Function minimization and random numbers
    ... Well, .NET's type system makes the distinction, allowing conversions ... lacks closures. ... design but it culminated in F# rather than delegates. ... Are you claiming that the C# support for closures is useless? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Design Patterns and Functional programming
    ... closures are now widely exploited. ... If OOP and FP were different paradigms, one would be unable to mix them. ... Yet a consistent type system would be able to describe either. ... also used pattern matching, the project would collapse a bit sooner, ...
    (comp.object)