News for hackers. Stuff that matters.
Re:Advanced programming languages (2009) by feiss on Sunday June 19, 2016 @12:59PM (#11933627)
What's up with functional languages nowadays? The exists since the dawn of humanity, but they are getting very trendy lately. Is it just my perception? Is it a HN thing? (I've been a reader for just some months)
Re:Advanced programming languages (2009) by bluejekyll on Sunday June 19, 2016 @01:05PM (#11933656)
A quick idea, as systems have become more complex, needing more threading and such to perform at scale, I think many developers are reaching for functional programming techniques to make the code easier to reason about.

I'm not a pure functionalist, but I recognize some nice things: immutable by default, composition instead of inheritance, chained operations/monads.

I've personally become a huge fan of Rust, while this isn't a pure functional language, it definitely inherits a lot from them, but it also doesn't force FP on you.

Re:Advanced programming languages (2009) by jghn on Sunday June 19, 2016 @01:04PM (#11933649)
2 things IMO

- There's a long running pendulum that swings back and forth from FP. We're currently in an FP cycle.

- Current mainstream computing puts a heavier emphasis on concurrency and distributed computing. FP's focus on immutability and referential transparency makes it easier to reason about these.

Re:Advanced programming languages (2009) by nazka on Sunday June 19, 2016 @02:00PM (#11933866)
> There's a long running pendulum that swings back and forth from FP. We're currently in an FP cycle.

I think this is also happening because Functional Programming can really give us advantages, but also because it is very hard to understand fully (I am looking at you monads). We see how it can reduce: the complexity, the concurrency problems, or how we can code faster with it. But when we try to use it in a production environment, we give up because it's too complex. So you have this back and forth here in the field, between every wow moment with FP being all cool, and then being too hard to "get" or to use in production.

Now I think we are getting there slowly. Trend after trend, we have more and more the main languages that are really incorporating FP principles. And not just as features. Plus many companies are pushing FP languages forward. Swift is a significant push for it that should democratize FP principles to the "masses", rather than a more "academic" crowd.

Re:Advanced programming languages (2009) by kmiroslav on Sunday June 19, 2016 @02:02PM (#11933870)
They're not, really.

A couple of concepts have become trendy: composition and immutability.

The former is certainly a staple of FP but the latter, not as much (a lot of languages considered functional support both mutability and immutability).

Re:Advanced programming languages (2009) by ape4 on Sunday June 19, 2016 @01:04PM (#11933650)
The usual explanation is that they're good for safe parallelism on multicores. Which are everywhere now - even phones.
Re:Advanced programming languages (2009) by olavk on Sunday June 19, 2016 @02:49PM (#11934089)
Pure FP languages are still pretty niche, but what has happened is the big mainstream languages like C# and Java has adopted more functional features like higher order functions, lambda syntax, increased focus on immutability and so on. So functional languages are clearly trendy among the language designers, from where the inspiration trickle down to the mainstream.
Re:Advanced programming languages (2009) by yoz-y on Sunday June 19, 2016 @01:06PM (#11933661)
My guess is that it is a result of processors getting faster, memory bigger and compilers better (and GUIs more complex). Functional languages do have some performance penalty over highly optimised code directly manipulating memory but for most usages such performance is not needed. Thus programmers tend to trade some of it for clarity of code and safety.
Re:Advanced programming languages (2009) by vram22 on Sunday June 19, 2016 @02:07PM (#11933896)
> since the dawn of humanity

Since near the dawn of computing is more like it :), but I get what you mean. There was this early language by John Backus (yes, of BNF fame) called FP (sic), though Lisp may have been the first one.

Re:Advanced programming languages (2009) by fulafel on Sunday June 19, 2016 @04:16PM (#11934483)
Concepts that originated in functional languages have been slowly percolating to everyday use via dynamic languages, things like first class functions, map/reduce, closures, lambda etc. Bouncing these buildings blocks in your head for 10 years or so makes the rest of the FP concepts look pretty natural and a logical next step even if you're just joe programmer in the trenches.
Re:Advanced programming languages (2009) by vram22 on Sunday June 19, 2016 @02:10PM (#11933908)
It's been a trend for some years now (not just recently), due to reasons others here have said, such as multi-core, immutability, easier to reason about, etc. E.g. a friend of mine was in a startup that was using Clojure in production over 5-6 years ago.
Re:Advanced programming languages (2009) by shrugger on Sunday June 19, 2016 @01:03PM (#11933648)
Reasonability. In an age where billion dollar companies are gutted by 16yo hackers on a monthly basis, it's worth the effort to build strong, secure systems that can be formally reasoned about.
Re:Advanced programming languages (2009) by formula1 on Sunday June 19, 2016 @01:35PM (#11933773)
Its disengenious to imply that functional cant be as insane as procedural. Also, everything is strong and securw until vulnerabilities are found (heartbleed as an example). Its in the hackers best interest to never let these vulnerabilities known. Also since there are many less eyes on less popular languages, vulnerabilities will take more time to be discovered.
Re:Advanced programming languages (2009) by nv-vn on Sunday June 19, 2016 @02:45PM (#11934062)
The combination of stronger type systems (especially dependent typing), less error-prone design (no manual memory management, no mutation, no global state, no loops/off-by-one errors), separated side effects (crashing during computation won't break things, less places for outside interference/external failure, etc.), and better error handling (no null, usually no exceptions meaning you have to encode failure into the return value itself without losing type information) solves many common bugs in imperative code.
Re:Advanced programming languages (2009) by formula1 on Sunday June 19, 2016 @04:00PM (#11934421)
Type systems - already available in the most popular languages

no memory management - c++, go, java come to mind

No mutation - has a side effect which you probably will never mention. But it will become important as the internet of things gets smaller

No global state - in what environments would that ever be an encouraged paradigm? Javascript?

No loops/off by one - you still need loops, they are just recursive. The difference is you need to jump around to figure out what the hell is going on instead of reading it top to bottom

Better error handling - nothing you just said seems better to me

Sure, there are many thing I like about functional languages. I like how you can create a tree to reason about you code to the point it looks like a flowchart. It has forced me to question my own coding style and how I compartmentalize and where I can run things in parralel. How infinite lists, streams and arrays can all be considered the same interface. But I think there is room for growth.

- forces me to the bottom of a document to find out where it starts

- uses obscure language in order to avoid oop

- Cannot use symbols represent the start and end of a typed object constructor with a single string argument (regex, jsx, queries, etc)

Re:Advanced programming languages (2009) by jghn on Sunday June 19, 2016 @04:30PM (#11934532)
I don't believe GP meant 'type systems' the way you mean them. He's talking about the more powerful concepts such as dependent typing, not just the existence of types.

There are very few popular languages which would fit this category IMO, depending on how one defines powerful type system and popular. Scala is the only candidate that I can think of for my own definitions of those two concepts.

Re:Advanced programming languages (2009) by SkyMarshal on Tuesday June 21, 2016 @11:49AM (#11946585)
>Type systems - already available in the most popular languages

This implies you haven't actually spent time with a strongly typed functional language like Haskell. Once you have, it's hard to continue thinking of Java or C++ as having "type systems".