Juniper programming language
Seairth
Posts: 2,474
in Propeller 2
I recently came across Juniper, A Functional Reactive Programming Language for Arduino. I find the idea behind the language intriguing, and can't help but wonder if it (or something like it) would be really well suited for the P2. Has anyone else seen or used this language?
Comments
Last time I looked at functional programming, it was a look at Haskell....
https://wiki.haskell.org/Why_Haskell_matters
Not sure about a very-niche language applied to a niche part... ?
I think P2 needs mainstream languages.
-Phil
For a start in a pure functional language a function can only take parameters in, calculate some result, and return it. It should do that exact same thing whenever it is called with the same parameters.
So a function can have no side effects, like printing something or changing a LED state. It can have no internal state that might cause it to return different values when called with the same parameters. You can't write a pure functional timeNow() function.
Then all variables are immutable. Once they have been assigned a value you can never change that value. If you want a new value you need a different name for it.
All of this has very sound logic behind it in terms of reasoning about how your program works. But heck it's hard to work with.
I don't know about Juniper but often "functional" programming languages bend the rules a bit so that people can actually get stuff done. Like I/O !
Of course, "functional programming" is a style of program design that you can do in almost any language.
Why anyone would want this in little programs on the little Arduino I have no idea.