projects: update some short descriptions
[nit.git] / examples / clock.nit
index 8fdb9ab..3a081da 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# This module provide a simple wall clock.
-# It is an example of getters and setters.
+# Example of a simple wall clock class with generalized getters and setters.
+#
 # A beefed-up module is available in clock_more
 module clock
 
 # A simple wall clock with 60 minutes and 12 hours.
 class Clock
        # total number of minutes from 0 to 719
-       var total_minutes: Int
+       var total_minutes: Int is noinit
        # Note: only the read acces is public, the write access is private.
 
        # number of minutes in the current hour (from 0 to 59)
@@ -46,9 +46,7 @@ class Clock
 
        redef fun to_s do return "{hours}:{minutes}"
 
-       fun reset(hours, minutes: Int) do self.total_minutes = hours*60 + minutes
-
-       init(hours, minutes: Int) do self.reset(hours, minutes)
+       fun reset(hours, minutes: Int) is autoinit do self.total_minutes = hours*60 + minutes
 
        redef fun ==(o)
        do