The Hyper Programming Language

Comments

Hyper supports two sorts of comment: comment that spans only one line and comment that spans more than one line. Those things are also supported in C++ and Java, but in Hyper it is somewhat different.

Single line comments

A single line comment is usually started with a "#" symbol. Another "#" terminates the comment; if no other "#" is on the same line, the comment is assumed to continue to the end of that line. You can have multiple comment sections on the same line.

Starting from version 0.3.38 of the compiler, a second type of comment is supported. This comment starts with two hash characters "##" and no space in between. Other "#" characters to the right are ignored; the comment reaches to the end of the current line. It's useful to easily uncomment a line that already contains comment(s).

Multiline comments

Multiline comment markers consist of two symbols. These comments are truly "multiline": they have to span entire lines, not just the last part of the first line to the first part of the last line. So the markers need to be the first non-white characters on their line. The starting marker is "/#", and the ending marker is "\#". These comments can be nested. An important thing to note is that everything on the same line as the markers is also considered comment.

The form of the markers was chosen to give you an easy way to distinguish the begin- and end-markers. The following sketch (which is not valid to write in Hyper, by the way) illustrates this:

		  ____________
		/#
		|  THIS IS A BLOCK
		|
		|    OF COMMENT
		\#____________

Example

/#
	Test file for comments
\#

/# You should know that there is
\# no namespace here.
	
# Do you really know that this is a class?
class Test
	
	procedure # you know that this is a comment? # lookWhoIsTalking()
		# we're now inside the procedure 'lookWhoIsTalking'
		
		var abcd : bool = false
		if abcd then # is abcd true?
		  # yes, abcd is true
		else # not abcd #
		  # no, abcd is false
		end
		
		var#these are#x#embedded#:#comments#int
	end
	
	static procedure main( )
		var t : Test
		t.lookWhoIsTalking #  # ERROR: syntax error (not a comment)
		t.lookWhoIsTalking ## OK, not a syntax error
		t.lookWhoIsTalking #  # ERROR: not a comment # here OK
		t.lookWhoIsTalking #  ## OK # here still OK
		t.lookWhoIsTalking #  # ## OK, not a syntax error # still OK
	end
end

# this file is done

Valid HTML 4.01 Strict Valid CSS!