Live data from Hacker News

Ask HN: Does imperative programming have a (mainstream) future?

news.ycombinator.com

11–12 of 12 posts

Re: Ask HN: Does imperative programming have a (mainstream) future?

#11

Earlier quoted context omitted.

> I think more and more programmers are realizing that the functional approach is almost always superior. Only for a very limited definition of "almost always". It's almost always superior if you don't hit performance constraints, and if your problem isn't dominated by sequencing, and if your team can handle the functional approach, and if ... Why is it superior? It controls the state space explosion, and therefore m…

>When could your problem be dominated by sequencing? It often is in embedded systems, where you're sequencing external hardware to get it to do real-world things. I mean, yes, you could write all that in a monad, but if that's the dominant thing you need to control, what does it gain you? That was exactly what I was referring to with the Arduino board example ;)

Haskell has been used to build embedded software to great effect. As you move out of the domain of simple sequencing in embedded systems and into hard realtime systems, coordinating tasks correctly becomes very difficult. Being able to track and infer information about timing and dependencies with the type system becomes extremely useful in order to make it easier. This is a very simple intro example of an DSL built in Haskell for realtime systems[0]. This is a talk on using Haskell for robotics in particular[1].

[0] https://leepike.wordpress.com/2009/05/05/an-atomic-fibonacci... [1] https://vimeo.com/77164337

Post reply on HN