• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

5.3 Syntax changes since SWI-Prolog 7
All Application Manual Name SummaryHelp

  • 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.176We 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.177Suggested by Joachim Schimpf. A good use-case for this is a unit library178https://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'.

ClioPatria (version V3.1.1-51-ga0b30a5)