5.3 Syntax changes since SWI-Prolog 7
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • SWI-Prolog extensions
        • Syntax changes since SWI-Prolog 7
          • Operators and quoted atoms
          • Compound terms with zero arguments
          • Block operators
    • Packages

5.3.1 Operators and quoted atoms

As of SWI-Prolog version 7, quoted atoms lose their operator property. This means that expressions such as A = 'dynamic'/1 are valid syntax, regardless of the operator definitions. From questions on the mailinglist this is what people expect.172We believe that most users expect an operator declaration to define a new token, which would explain why the operator name is often quoted in the declaration, but not while the operator is used. We are afraid that allowing for this easily creates ambiguous syntax. Also, many development environments are based on tokenization. Having dynamic tokenization due to operator declarations would make it hard to support Prolog in such editors. To accommodate for real quoted operators, a quoted atom that needs quotes can still act as an operator.173Suggested by Joachim Schimpf. A good use-case for this is a unit library174https://groups.google.com/d/msg/comp.lang.prolog/ozqdzI-gi_g/2G16GYLIS0IJ, which allows for expressions such as below.

?- Y isu 600kcal - 1h*200'W'.
Y = 1790400.0'J'.