Next: , Previous: , Up: Scheme Syntax   [Contents][Index]


6.18.1.3 Block Comments

In addition to the standard line comments defined by R5RS, Guile has another comment type for multiline comments, called block comments. This type of comment begins with the character sequence #! and ends with the characters !#.

These comments are compatible with the block comments in the Scheme Shell scsh (see The Scheme shell (scsh)). The characters #! were chosen because they are the magic characters used in shell scripts for indicating that the name of the program for executing the script follows on the same line.

Thus a Guile script often starts like this.

#! /usr/local/bin/guile -s
!#

More details on Guile scripting can be found in the scripting section (see Guile Scripting).

Similarly, Guile (starting from version 2.0) supports nested block comments as specified by R6RS and SRFI-30:

(+ 1 #| this is a #| nested |# block comment |# 2)
⇒ 3

For backward compatibility, this syntax can be overridden with read-hash-extend (see read-hash-extend).

There is one special case where the contents of a comment can actually affect the interpretation of code. When a character encoding declaration, such as coding: utf-8 appears in one of the first few lines of a source file, it indicates to Guile’s default reader that this source code file is not ASCII. For details see Character Encoding of Source Files.