Performance potential of SSU => vs :-

Here’s an edge case I’ve run up against. This predicate is deterministic if the 2nd argument is a variable:

%! b64_to_utf8_to_atom(+BytesBase64, -Atom) is det.
b64_to_utf8_to_atom(BytesBase64, Atom) :-
    base64_ascii(Utf8, BytesBase64),
    atom_codes(Utf8, Utf8codes),
    phrase(utf8_codes(Codes), Utf8codes),
    atom_codes(Atom, Codes).

However, if it’s called in a “checking” environment (e.g. b64_to_utf8_to_atom('ZmlsZQ==',package),then it’s semidet; therefore, I can’t use the det/1 directive for it.

Of course, I could work around this by b64_to_utf8_to_atom('ZmlsZQ==',MaybePackage),MaybePackage=package, but that defeats one of the nice things about Prolog.

A variant of this: it might be nice to have a semidet/1 directive that verifies there are no choice points if the predicate succeeds, but also allows failure.