News for hackers. Stuff that matters.
Re:Why not C++? by amelius on Saturday March 05, 2016 @02:52PM (#11230744)
This works, until you start coding an imperative-style interpreter in the functional language, and mess everything up again :)

Anyway, I believe we should have the best of both worlds: a language which for the outer layers (the "outer loops" so to speak) uses functional style, and for the inner parts allows imperative style (of course the programmer should make sure that no side-effects remain visible here to the encompassing layer).

Re:Why not C++? by chriswarbo on Saturday March 05, 2016 @03:08PM (#11230825)
Take a look at Haskell's Single Threaded (ST) data type, which does exactly this:

https://wiki.haskell.org/Monad/ST

Re:Why not C++? by vamega on Saturday March 05, 2016 @06:40PM (#11231662)
ST is the efficient version of the State Monad. Where did you come to think that St was short for single threaded?
Re:Why not C++? by chriswarbo on Sunday March 06, 2016 @10:31AM (#11234075)
From https://wiki.haskell.org/Monad/ST

> The ST monad lets you use update-in-place, but is escapable (unlike IO). ST actions have the form:

    ST s α
> Meaning that they return a value of type α, and execute in "thread" s. All reference types are tagged with the thread, so that actions can only affect references in their own "thread".

> Now, the type of the function used to escape ST is:

    runST :: forall α. (forall s. ST s α) -> α
> The action you pass must be universal in s, so inside your action you don't know what thread, thus you cannot access any other threads, thus runST is pure. This is very useful, since it allows you to implement externally pure things like in-place quicksort, and present them as pure functions ∀ e. Ord e ⇒ Array e → Array e; without using any unsafe functions.
Re:Why not C++? by groovy2shoes on Sunday March 06, 2016 @12:47PM (#11234653)
Take a look at Scheme, Racket, OCaml, and Standard ML.