Option/2 question

In library(option) option/2 has what looks like an inconsistency. Consider:

?- option(format(F),[format(text)]).
F = text.

?- option(format(F),[format=text]).
F = text.

This is as expected. Then if we do:

?- option(format=F,[format(text)]).
false.

Also as expected since the first arg is supposed to be in canonical format as above. But if we try:

?- option(format=F,[format=text]).
F = text.

So the =/2 format works but only if the option is also in that format. Seems slightly inconsistent. In the docs =/2 is not supposed to be supported for arg 1 but works in the last example.

I ran across this trying to use library(option) to process key/value pair lists. I can’t use it after all for other reasons, but I was curious about the behavior I saw above. Is there a specific reason for it?

Thanks

Somewhere in the past options with multiple arguments were used, such as address(Host,Port). If you query using format=F you are actually using this part of the interface, but in a wrong way. Not really sure how to deal with that. I guess the only way is to explicitly check for =/2 and raise an error. I wonder whether that is worth the trouble?

I’m sure it’s not worth the trouble. I just ran across this and it confused me for a minute or two while testing some things. Thanks!