A bit of an abstract topic #1717
Replies: 1 comment 6 replies
-
You made the right choice asking humans! Hylo advocates for mutable value semantics, which means we retain the ability to modify (part of) values in place. So you can write your program as follows:
There's nothing wrong with tail recursion. In fact the code that you wrote should normally compile to a while loop (assuming a decent optimizer). It's more "functional" than the in-place update I have shown but it is equivalent. That's actually part of the beauty of mutable value semantics. Several of the people working on Hylo have talked about MVS in more depth in various places so I won't write a novel here. You can check the README page of the compiler's repo for a few links to relevant talks and papers. Of course you're also welcome to come back here if you have any specific question. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I can't find an answer to the question about how the program is structured in pure value semantics. ChatGPT told me that these are the very schemes of the Hylo program
That is, it is a recursive function that calls itself with a new value. At the same time, there is some asynchronous input (from hardware, network or framework). He also says that you can save our state outside this loop, like a global variable, but this is very bad. Is he right?
Beta Was this translation helpful? Give feedback.
All reactions