News for hackers. Stuff that matters.
Re:Brett Slatkin: Why am I building a new functional program... by karmakurtisaani on Sunday March 05, 2023 @10:49AM (#35030620)
> The hypothesis I aim to test with a new programming language is: By making different tradeoffs, these issues can be mitigated and a more broadly-appealing functional language can be built. With such a language, I hope that the true promise of functional programming for parallel computing can be widely realized.

Proceeds to give zero indication how to achieve this.

Re:Brett Slatkin: Why am I building a new functional program... by karmakaze on Sunday March 05, 2023 @11:04AM (#35030787)
Very disappointed by the non-announcement. If it were a corp, it would be FUD.

I'm curious as to what these different trade-offs are.

> My conclusion is that there are major, well-justified reasons for why people strongly dislike functional languages.

My conclusion is because most everyone is taught to think empirically and 'play computer' that functional doesn't fit in their preconceived brains. I once had someone say SQL didn't make sense because it's SELECTing fields (i.e. vars) before they're defined/assigned later in the (binding) expressions.

People having trouble with FP is like how people who learn databases using ORM's don't deal well with SQL as expressions of set operations.

There are varying limits to how much people like and handle abstract constructs before applying the construction to the data at hand but you can do a whole lot of effective and unsurprising development before getting to such esoteric levels.

Edit: I was super-excited to open the link, and now on re-reading expect this new FP language to be as much an advancement as Go was to 'systems' programming. I hope I'm mistaken. Also odd that only Haskell and Lisp were mentioned when there are so many others. On the plus-side if Google were to make F# and back it as well as they have Go, that would be a win-win.

Re:Brett Slatkin: Why am I building a new functional program... by karmakaze on Sunday March 05, 2023 @11:58AM (#35031407)
After reading their other post "The case for dynamic, functional programming", I would classify this as FUD, or rather NIH. Go got support by being touted as "Not Java". I can't say that this would gain much by being declared as "Not Elixir".
Re:Brett Slatkin: Why am I building a new functional program... by lolinder on Sunday March 05, 2023 @12:40PM (#35031901)
> it would be FUD

I thought FUD stood for Fear Uncertainty Doubt—it's usually used to indicate that something is designed to sow fear for clicks or for some ulterior motive, not for insubstantial non-announcements.

Did something in this post evoke fear?

Re:Brett Slatkin: Why am I building a new functional program... by karmakaze on Sunday March 05, 2023 @12:48PM (#35031990)
The point of FUD is usually to carve out a space where existing products/solutions can't compete with idealized vapourware. I updated my opinion to NIH (though could be both)--and still hope to be mistaken.
Re:Brett Slatkin: Why am I building a new functional program... by worksonmine on Sunday March 05, 2023 @10:56AM (#35030699)
In his defense the title is "why" not "how". I guess you'll have to spend some sleepless nights waiting for the follow-up.
Re:Brett Slatkin: Why am I building a new functional program... by bslatkin on Sunday March 05, 2023 @11:30AM (#35031066)
I'm sorry to make you wait.
Re:Brett Slatkin: Why am I building a new functional program... by jalk on Sunday March 05, 2023 @10:53AM (#35030666)
> My conclusion is that there are major, well-justified reasons for why people strongly dislike functional languages.

I'm sure there are a multitude of different reason and likely require different conflicting tradeoffs to address

Re:Brett Slatkin: Why am I building a new functional program... by bslatkin on Sunday March 05, 2023 @11:31AM (#35031083)
It's true and that is one of the largest challenges. Producing something that feels familiar (but not error prone) has been the way I've solved such conflicts so far.
Re:Brett Slatkin: Why am I building a new functional program... by lolinder on Sunday March 05, 2023 @10:54AM (#35030678)
It's a four paragraph blog post answering the question "why?". I'm not sure why you expect him to delve into the how at this stage: he probably doesn't have anything fully formed yet.
Re:Brett Slatkin: Why am I building a new functional program... by iampims on Sunday March 05, 2023 @11:00AM (#35030746)
https://twitter.com/haxor/status/1582878447134572544?s=20

Looks like the syntax is taking shape at least.

Re:Brett Slatkin: Why am I building a new functional program... by noelwelsh on Sunday March 05, 2023 @11:32AM (#35031092)
No language syntax needs return in 2023.
Re:Brett Slatkin: Why am I building a new functional program... by bslatkin on Sunday March 05, 2023 @12:03PM (#35031469)
How should an early return if statement work instead?
Re:Brett Slatkin: Why am I building a new functional program... by noelwelsh on Sunday March 05, 2023 @02:46PM (#35033193)
When if is an expression early returns aren't really a problem.
Re:Brett Slatkin: Why am I building a new functional program... by bslatkin on Sunday March 05, 2023 @03:46PM (#35033768)
I understand what you mean. But I expect most potential users want explicit returns because they're familiar and more approachable for beginners.
Re:Brett Slatkin: Why am I building a new functional program... by noelwelsh on Sunday March 05, 2023 @04:18PM (#35034031)
I disagree. You make two claims: familiarity, and beginner friendliness.

For the first, I think it's a mistake to perpetuate the mistakes of the past. I don't think JS developers have had problems adjusting to the lack of return in arrow functions.

Beginners have no preconceived notions of how a programming language should operate, and return makes the language model more complex.

1 + 1 evaluates to 2, but (in a language that requires return)

def foo = 1 + 1

foo

doesn't for no good reason. This breaks the simple substitution model of evaluation.

These claims could be addressed emperically, but I guess neither of us are going to do the research. :-)

Re:Brett Slatkin: Why am I building a new functional program... by bslatkin on Sunday March 05, 2023 @11:37PM (#35037559)
For a very simple, single-expression lambda function I agree you don't need an explicit return. Even Python skips the "return" for lambdas. But for anything more complex, I find explicit returns, especially early returns, makes the code much more readable for people who are used to imperative languages.

For example, which of these is more clear to people who don't know Lisp? I'd argue the second one because of the early return if guard.

    ---- THIS ----

    (defun sum-helper (items total)
        (cond
            (items
                (sum-helper
                    (cdr items)
                    (+ total (car items))))
            (t total)))

    (defun sum (&rest items)
        (sum-helper items 0))

    (print (sum 1 2 3 4))

    ----- OR -----

    (defun sum-helper2 (items total)
        (if (not items)
            (return-from nil total))

        (sum-helper
            (cdr items)
            (+ total (car items))))

    (defun sum2 (&rest items)
        (sum-helper2 items 0))

    (print (sum2 5 6 7 8))
        (sum-helper items 0))
Re:Brett Slatkin: Why am I building a new functional program... by noelwelsh on Monday March 06, 2023 @06:03AM (#35039612)
I think I'll write a blog post in response, as I believe this illustrates a much deeper and more important issue.
Re:Brett Slatkin: Why am I building a new functional program... by bslatkin on Monday March 06, 2023 @09:12AM (#35041205)
Great! Please send it my way so I don't miss it. Thank you
Re:Brett Slatkin: Why am I building a new functional program... by noelwelsh on Monday March 06, 2023 @01:02PM (#35044840)
I have a draft up here: https://noelwelsh.com/posts/fp-is-based/

(It should be readable but hasn't had a final editing pass.)

Re:Brett Slatkin: Why am I building a new functional program... by bslatkin on Sunday March 05, 2023 @11:10AM (#35030863)
Thanks! Right now the language's codebase is about 50KLOC. There's an interpreter for fast iteration and a compiler built on LLVM for producing native binaries. I'd like to make more progress on the parallel computing functionality before sharing it more widely.
Re:Brett Slatkin: Why am I building a new functional program... by tsegratis on Sunday March 05, 2023 @11:02AM (#35030763)
He's going for apple/iphone style of drip feed product announcements to build excitement

Look at us salivating for his big unveil -- we've probably already written more than he did

Re:Brett Slatkin: Why am I building a new functional program... by User23 on Sunday March 05, 2023 @10:56AM (#35030693)
It basically comes down to nondeterminism. Pure functional languages supposedly make it easier to exploit associativity, commutativity, and distributivity to allow many expressions to have nondeterministic semantics that are amenable to concurrent execution. Argument evaluation also can be specified nondeterministic so the runtime is free to execute something like the following with two or more CPU threads:

  f(g(), h())
Of course a well designed imperative language could also avoid overspecifying deterministic semantics and open itself up to similar optimizations, but for various reasons that hasn’t caught on. One example would be specifying the conditional to select a branch with a true guard nondeterministically rather than deterministically in the order of appearance in the program text. Dijkstra’s EWDs give many practical examples of why one might want such a thing.

Another example would be deducing when statement composition is symmetric and allowing nondeterminism when it is. For example if f and g don’t have access to each other’s data then the following can be executed in two threads even with mutation:

  f(); g()
Side effects will appear nondeterministically though which may or may not be a problem. As always an algorithm needs to be designed for the semantics the language has not those the programmer wishes it does.
Re:Brett Slatkin: Why am I building a new functional program... by alexisread on Sunday March 05, 2023 @03:29PM (#35033625)
This makes a good case for effect systems in conjunction with FP, so they can be reasoned about as well. Something like https://koka-lang.github.io/koka/doc/index.html

Having said that, having something like Daedelus in there as well would give a handle on temporal-based determinism, and then some allowance for delimited continuations would top things off nicely.