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

2.16.1 ISO Syntax Support
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Overview
        • The SWI-Prolog syntax
          • ISO Syntax Support
            • Processor Character Set
            • Nested comments
            • Character Escape Syntax
            • Syntax for non-decimal numbers
            • Using digit groups in large integers
            • NaN and Infinity floats and their syntax
            • Force only underscore to introduce a variable
            • Unicode Prolog source
            • Singleton variable checking
    • Packages

2.16.1.7 Force only underscore to introduce a variable

According to the ISO standard and most Prolog systems, identifiers that start with an uppercase letter or an underscore are variables. In the past, Prolog by BIM provided an alternative syntax, where only the underscore (_) introduces a variable. As of SWI-Prolog 7.3.27 SWI-Prolog supports this alternative syntax, controlled by the Prolog flag var_prefix. As the character_escapes flag, this flag is maintained per module, where the default is false, supporting standard syntax.

Having only the underscore introduce a variable is particularly useful if code contains identifiers for case sensitive external languages. Examples are the RDF library where code frequently specifies property and class names26Samer Abdallah suggested this feature based on experience with non-Prolog users using the RDF library. and the R interface for specifying functions or variables that start with an uppercase character. Lexical databases were part of the terms start with an uppercase letter is another category were the readability of the code improves using this option.

ClioPatria (version V3.1.1-21-gb8003bb)