Works also in SWI-Prolog. Just try this:
?- set_prolog_flag(double_quotes, atom).
?- http_open("https://news.ycombinator.com", S, ),
load_html(S, DOM, ),
xpath(DOM, //a(@class="storylink",text), E),
PE Anatomist – Explore data structures in PE files
I didn’t test setting
double_quotes flag to
string. Might or might not work, dunno.
double_quotes flag controls not the parsing but the term building during parsing. The double quotes syntax is always the same, but depending on the flag the token is mapped to different Prolog atomics or even Prolog terms such as lists.
When SWI-Prolog did an article " 5.2.3 Why has the representation of double quoted text changed?", the meaning is only that the default value of
double_quotes flag was changed from the value
codes to the value
string. But I really don’t know whether the default value
string works in the above example.
You have to test yourself and maybe raise a feature request. But as Jan W. already observed, there might be obstacles such as unification. Its also not clear to me what Scryer Prolog does. What is
"storyline" in Scryer Prolog? Does it unify with a cons cell
[H|T]? Its difficult to say what the compatiblity issues are.
From Scryer Github:
Strings and partial strings
In Scryer Prolog, the default value of the Prolog flag
chars , which is also the recommended setting.
The chars option is also available in SWI-Prolog, required by ISO core standard. But a compact representation might be missing in SWI-Prolog. But this doesn’t make it clear why for example the argument to http_open/2 “https://news.ycombinator.com” works in Scryer.
To really understand whats is going on, install Scryer and see what it is doing. From an ISO core standard perspective, atoms that are just char lists would break the Prolog system. Since then
abc would unify with
[H|T], something the ISO core standard doesn’t propose.