r/ProgrammingLanguages • Futhark • Jan 04 '26

Another termination issue

https://futhark-lang.org/blog/2026-01-04-another-termination-issue.html
18 Upvotes

17 comments sorted by

View all comments

Show parent comment

1

u/matthieum Jan 06 '26

Also, Futhark is Turing-complete, so there is no guarantee compilation would even terminate in the first place.

This is typically handled by a notion of "fuel" or a limited number of interpreter steps -- with a way to raise the limit when necessary.

This can take an extremely long amount of time.

I'm confused.

I thought those constants were already evaluated at compile-time -- which is how thunks were avoided in the first place.

If they are instead evaluated at run-time -- I assume at the start of the program, then? -- then the same possibility applies: store the result in Result<T, E> and replace each use of the value by try value.

This unfortunately leads to a branch at each use, but perhaps that's acceptable?

2

u/Athas Futhark Jan 06 '26

They are evaluated at program startup. Storing and updating a thunk is not acceptable for Futhark's target environments; I went into detail here: https://www.reddit.com/r/ProgrammingLanguages/comments/1q3pq54/another_termination_issue/nxpgl83/