News for hackers. Stuff that matters.
Re:Six programming languages I’d like to see by eatonphil on Wednesday July 13, 2022 @09:20AM (#32082274)

  input = 1

  out1: input + 1
  #out1 is now 2

  input = 4
  #out1 is now 5

  out2: out1.replace(+, -)
  #out2 is now 3

  # let's pull an APL
  input = 4 2
  #out1 is 5 3
  #out2 is 3 1
The reactive programming idea a la Excel but text-based looks really neat. I'd love to play around with that kind of thing.
Re:Six programming languages I’d like to see by kej on Wednesday July 13, 2022 @09:54AM (#32082755)
I haven't used it beyond playing with the tutorial, so I don't know how well it works in practice, but Svelte does this with JavaScript: https://svelte.dev/tutorial/reactive-declarations
Re:Six programming languages I’d like to see by nathancahill on Wednesday July 13, 2022 @10:14AM (#32083030)
I've been using Svelte in production for ~3 years now. Hard to go back once you get used to reactive programming.
Re:Six programming languages I’d like to see by arethuza on Wednesday July 13, 2022 @09:23AM (#32082323)
I have a vague recollection that the language used by MS PowerApps might work like that:

https://docs.microsoft.com/en-us/power-platform/power-fx/ove...

Re:Six programming languages I’d like to see by shreyshnaccount on Wednesday July 13, 2022 @09:36AM (#32082512)
doesn't interactive Julia (that's what it's called?) do this? i remember seeing an example but i might be misremembering things
Re:Six programming languages I’d like to see by francogt on Wednesday July 13, 2022 @09:56AM (#32082780)
Pluto.jl[1] works like this. It’s a reactive notebook. It’s a really neat project.

[1]https://github.com/fonsp/Pluto.jl

Re:Six programming languages I’d like to see by shreyshnaccount on Wednesday July 13, 2022 @10:10AM (#32082981)
Ah yes, that's what I was thinking about. thanks! its so cool xD
Re:Six programming languages I’d like to see by sdfhdhjdw3 on Wednesday July 13, 2022 @10:02AM (#32082851)
Yes. And Julia also does the "optimized version of...". It dispatches on types.
Re:Six programming languages I’d like to see by hota_mazi on Wednesday July 13, 2022 @10:09AM (#32082967)
This looks like hell to me. It's side effects to the tenth power, which must make debugging an absolute nightmare.
Re:Six programming languages I’d like to see by mlajtos on Wednesday July 13, 2022 @10:40AM (#32083405)
Not really – you won't get into an inconsistent state when everything is reactive. One thing that might lead to catastrophe is having cyclic dependencies, but reasonable runtime/compiler can detect those.
Re:Six programming languages I’d like to see by hota_mazi on Wednesday July 13, 2022 @11:37AM (#32084170)
> you won't get into an inconsistent state when everything is reactive

That's like saying "There will never be bugs".

There will be bugs.

And when you come across one and you can change a variable and have another variable affected in some other part of your program and you have no idea how these two variables are connected, you are going to have a nightmare of a time debugging.

Re:Six programming languages I’d like to see by cmontella on Wednesday July 13, 2022 @11:53AM (#32084413)
You would only have no idea those variables are connected if the tooling for the language can't help you figure that out. Ideally, in such a language you could just query the program state to determine everything that would be influenced downstream. Also step-by-step execution and record/replay or program state can help debug those tricky issues. New paradigms of programming call for new paradigms of tooling and debugging, and figuring out what those are is part of the fun!
Re:Six programming languages I’d like to see by mlajtos on Thursday July 14, 2022 @06:44AM (#32094247)
Of course there will be bugs. But they won't be caused by the system NOT updating the variable when it should be. But it is still up to the programmer to create a valid reactive graph.

> you have no idea how these two variables are connected

Simply traverse the reactive graph to reveal how/if two variables affect each other.

Cycles and dynamically changing bindings are still problems, but they can be tackled.

Re:Six programming languages I’d like to see by Georgelemental on Wednesday July 13, 2022 @01:24PM (#32085865)
This would probably be terrible for application code. But when you are doing quick math/science exploration with mostly linear program flow and want to change a few things upstream, it could be useful. Everything has its place