Yielding prolog engines from within a foreign predicate

I agree. So maybe it’s better to just call it a suspend?

That said, while I don’t need this myself at the moment, I can see some use case for actually yielding in the way engine_yield does - with a term to return to either another prolog engine, or some outer caller of PL_next_solution(..). It seems to me that the mechanism would be largely the same to the current experimental native yield, with the only difference from an API perspective being that there needs to be some way to register the term being yielded, and somehow, the whole thing has to result in another yield code. Maybe there’s some unified strategy possible?

Agree. It would be fairly simply to do the engine_yield from C. I’m not sure it has significant value. Anyway, for now this is a rather obscure interface and we’ll see where it goes. If we decide to rename it we can always provided some compatibility macros.

1 Like