Did you know ... | Search Documentation: |
SWI-Prolog extensions |
This chapter describes extensions to the Prolog language introduced with SWI-Prolog version 7 in 2014. The changes bring more modern syntactical conventions to Prolog such as key-value maps, called dicts, as primary citizens and a restricted form of functional notation. They also extend Prolog basic types with strings, providing a natural notation to textual material as opposed to identifiers (atoms) and lists.
These extensions make the syntax more intuitive to new users, simplify the integration of domain specific languages (DSLs) and facilitate a more natural Prolog representation for popular exchange languages such as XML and JSON.
While many programs run unmodified in SWI-Prolog version 7, some require modifications, especially those that pass double quoted strings to general purpose list processing predicates. See section 5.2.4 and section 5.2.5 for information and tools on porting. We provide a tool (list_strings/0) that we used to port a huge code base in half a day.
While it's best for these changes to all be in one place now, in future it'll be confusing. In 2017 no one will care that the changes were introduced in 7.
Maybe the manual needs a stronger 'this is what we say Prolog is' focus and less 'here's where we are in the prolog world' focus? Writing the manual as if we assume you've never heard of prolog might be clearer for experienced users as well as beginners.
The manual really never says 'this is our syntax'. Instead it says 'we're ISO except for these 23 things'. That's not really helpful for the beginner or even the experienced programmer looking for 'I want to use . as an operator. What's .'s status?' or 'how do I represent the formfeed char in an atom?'