Property definitions

core $ Sys :: defaultinit
# The main class of the program.
#
# `Sys` is a singleton class, its only instance is accessible from everywhere with `sys`.
#
# Because of this, methods that should be accessible from everywhere, like `print` or `exit`,
# are defined in `Sys`.
# Moreover, unless there is an ambiguity with `self`, the receiver of a call to these methods is implicitly `sys`.
# Basically it means that the two following instructions are equivalent.
#
# ~~~nit
# print "Hello World"
# sys.print "Hello World"
# ~~~
#
# ## Methods Implicitly Defined in Sys
#
# `Sys` is the class where are defined top-level methods,
# i.e. those defined outside of any class like in a procedural language.
# Basically it means that
#
# ~~~nitish
# redef class Sys
#    fun foo do print "hello"
# end
# ~~~
#
# is equivalent with
#
# ~~~nitish
# fun foo print "hello"
# ~~~
#
# As a corollary, in a top-level method, `self` (the current receiver) is always `sys`.
class Sys
	# The main method of a program.
	#
	# In a module, the instructions defined outside any classes or methods
	# (usually called the *main* of the module) is
	# an implicit definition of this `main` method.
	# Basically it means that the following program
	#
	# ~~~nit
	# print "Hello World"
	# ~~~
	#
	# is equivalent with
	#
	# ~~~nit
	# redef class Sys
	#    redef fun main do
	#       print "Hello World"
	#    end
	# end
	# ~~~
	fun main do end

	# The entry point for the execution of the whole program.
	#
	# When a program starts, the following implicit sequence of instructions is executed
	#
	# ~~~nitish
	# sys = new Sys
	# sys.run
	# ~~~
	#
	# Whereas the job of the `run` method is just to execute `main`.
	#
	# The only reason of the existence of `run` is to allow modules to refine it
	# and inject specific work before or after the main part.
	fun run do main

	# Number of the last error
	fun errno: Int `{ return errno; `}
end
lib/core/kernel.nit:227,1--300,3