Did you know ... | Search Documentation: |
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'.