6 ms·
"Asked 11 years, 7 months ago" Has the need to use functional programming languages become obvious yet? Has C/C++ et al. fallen by the wayside, yet?
by arbitrage 6y ago
"Asked 11 years, 7 months ago"
Has the need to use functional programming languages become obvious yet? Has C/C++ et al. fallen by the wayside, yet?
- PaulHoule 6y agoDidn't they add lambdas to C?
- Pelic4n 6y agoThere is a non-standard compiler extension supporting them for GCC, but that's all. Also, I seriously hope they won't. The whole point of C in this day and age is extreme simplicity and portability. The latest standard, C17, has only corrections. C11 has really all that's needed for "modern" applications, aka a threading library which is not pthreads and decent unicode support.
- deleted 6y ago[deleted]
- short_sells_poo 6y agoC/C++ have not fallen to the wayside but most major programming languages have now inherited quite a few functional paradigms. I haven't kept up to date, but don't both C++ and Java have lambdas now? Don't they also feature currying? C++ is of course not Haskell, but that's not the point. Functional programming has become commonplace by procedural languages adopting the simpler/most-useful aspects.
- cies 6y agoIf it's not null-safe I will avoid it for new projects. Lambda's: great! But real null-safety, strong type safety, proper sum types, pattern matching/ type destructuring, are now my requirements. I'd say Kotlin is the language with the most adoption that ticks the boxes. And it is (not surprisingly) an OO lang.
- dunefox 6y ago> I'd say Kotlin is the language with the most adoption that ticks the boxes. How? Kotlin is decisively an object oriented language.
- sk5t 6y agoKotlin pattern matching and destructuring/unapply support are pretty weak, no?
- gher-shyu3i 6y agoYes, Java's pattern matching is much more fully fledged than Kotlin's. You can destructure nested types. Also, at some point in the (near) future, you should be able to do things like: Object o = new int[]{1, 2}; if (o instanceof int[] {var a, var b}) { // a == 1, b == 2 }
- gher-shyu3i 6y agoIncidentally, pattern matching that Java is getting is superior and more fully fledged to the one that exists in Kotlin. You can also have null safety in Java by means of annotations. You can also check out C# since it fits your requirements. It has pattern matching, but sum types are still in the works.
- cies 6y agoI've grown a strong dislike for annotations. One here or there is not the problem, but they will be used (I'm looking at you Spring) to add magic to my programs. I want to know what goes on; annotation hide what goes on. Debugging problems with annotations is a real pain. I like that in Kotlin the community seems to fight overuse of annotations (also they fight overuse of Exceptions which I really like: Exceptions are not a way to do multiple return values, sumtypes are).
- Zababa 6y agoI don't know about the currying, but Java has already lambda and optionals, and is getting immutable records, sealed class (product and sum types), pattern matching and type inference in Project Amber [1]. They all are features usually found in functional languages (Standard ML for example). [1]: http://openjdk.java.net/projects/amber/ http://openjdk.java.net/projects/amber/
- the_duke 6y agoPretty much every mainstream language has adopted concepts from FP. C++ has closures. Even Java is getting pattern matching. Everyone has map/fold. ... Most new languages I can think of have a concept of immutability and sum types. (Kotlin, Swift, Rust) Many languages are in fact converging on what seems like a local optimum, with a blend of functional and non-functional idioms. The line has become a lot blurrier, which makes the question hard to answer.
- mrkeen 6y agoC maps to the machine well. (Low-level programmers will probably crucify me for that.) But take its lack of closures as an example. Closures require either some kind of memory management, or clever program transformations, at which point you lose the simplicity of just having the stack and heap. As much as a generation of Java programmers (like myself) grew up thinking that C++ was old hat and Java was its natural successor, C++ has been quietly ahead of Java with regard to lambdas, generics, type-level trickery. Not to mention performance and backward-compatibility [1]. But reading C++ makes my eyes bleed. I much prefer FP for business logic and web-app development. Haskell is fast but it's no C++, and that's OK. I wouldn't want Haskell to take C/C++ market-share. I want it to compete against other languages that don't give me performance, safety or terseness. [1] C++17 on the Commodore 64: https://www.youtube.com/watch?v=zBkNBP00wJE https://www.youtube.com/watch?v=zBkNBP00wJE