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

2

u/ct075 Jan 04 '26

I suspect that, for any failing polymorphic value declaration def x: P('a) = e (where P('a) is some type expression featuring 'a), the declaration of x will always fail for any instantiation of 'a

After stepping away for a coffee, I think a better way to phrase my hunch might be:

If there is some instantiation of 'a that causes the top-level declaration of x to fail, then any instantiation of 'a will also fail.

Therefore, for the purposes of an interpreter, it is fine to run the top-level polymorphic value definition once with 'a = unit and discard the result - if the definition fails, then it may also fail in the compiled executable (it may not fail if the definition is never used, but that's already been litigated to be fine). This may cause the interpreter to fail in a different way than the compiled code due to the reordering, but now that's a "both fail" scenario.