5 ms·
I get he’s saying it has its place as a learning tool, but this is one reason I haven’t looked to seriously at some languages. For example, F# is a “functional
by shireboy 6y ago
I get he’s saying it has its place as a learning tool, but this is one reason I haven’t looked to seriously at some languages. For example, F# is a “functional language”, but as best I can tell I can do very similar with C# lambdas. To my (admittedly biased) view, F# is the extremist language and C# the middle-road.
- intricatedetail 6y agoMost of the time choosing a language is like a choosing the color or a trim of the same car. It is so boring.
- ludston 6y agoUsually different languages Are tied to different platforms so this isn't really anagolous.
- pjc50 6y agoIndeed. You have to pick a 4x4 or motorbike or limousine .. often before you know where you're going.
- intricatedetail 6y agoI'd think a language tied to a platform only can be considered if you want your product to be tied to such platform.
- rienbdj 6y agoYou haven’t tried a wide variety of languages then. I have found the language chosen massively shifts what is possible to write and what is convenient to write.
- p4bl0 6y agoReducing F# or functional programming to lambdas is a bit of a stretch. I don't know F# very well but I understand it is very close to OCaml which I know quite well. F# also has algebraic data types, match, type inference, static type checking, etc. I don't know if C# supports all this, but if it does its probably thanks to the existence of F# on the same .NET platform :).
- 1f60c 6y ago> algebraic data types, match, type inference, static type checking Of those, C# only has static type checking. AFAIK C# does have some limited type inference (when using LINQ), but it’s nowhere near as powerful and ubiquitous as F#, where the following is completely valid: let Add a b = a + b and it will be inferred as: let Add (a:int) (b:int) : int = a + b This also works in more complicated cases like when you’re accessing a property on a record, for instance.
- nicoburns 6y agoI think the latest C# also has match (a pattern matching overload of the switch keyword).
- marcosdumay 6y agoWhen you get anything close to abstracting syntax, C# lambdas start to require more boilerplate than the concrete syntax. Any advanced functional structure is completely not available.
- rienbdj 6y agoIndeed, the middle ground depends on your perspective. In my view F# is actually the middle ground between pure functional programming and traditional OOP! F# is much more than just C# with lambdas btw. If you want to write .net code in a functional style then F# is easily worth the time investment to learn.
- lou1306 6y agoJust a counterexample: partial function application. let add x y = x + y let f = add 2 Boom, now `f 4` evaluates to 6. I reckon that doing the same with C# would require a lot of boilerplate. (And I know I could have said `let f = (+) 2`, I just wanted to spell it out for those unfamiliar with F#)
- ByteJockey 6y agoWait, I'm missing something here, because it seems that C# would be the extremist language. It even fits the pithy little saying in the article: Classes are awesome. What if we made a PL where everything was a class? I mean, you can use lambdas, but last time I used C# you could still only use them inside a class definition.* *Note: I haven't used C# in a while, do you guys have free functions yet? If so, ignore this post, my knowledge is just outdated.