diff --git a/doc/sample/Person.im b/doc/sample/Person.im index fb23c49..c2d28b9 100755 --- a/doc/sample/Person.im +++ b/doc/sample/Person.im @@ -49,7 +49,7 @@ class Person **/ - init(name:name age:age) self::name = name. - self::age = age. + self::age = age! - test(param:data _:extra) | cout put:'Received {data}, {extra}'. @@ -68,16 +68,16 @@ class Person #years => self::age = age, #months => self::age = age / 12, #days => self::age = age / 365, - _ => self::age = 0, - end. + _ => self::age = 0 + end! - getAgeInUnit:units ^match units in #years => self::age, #months => self::age / 12, #days => self::age / 365, - _ => 0, - end. + _ => 0 + end! /* Properties are defined using the $ symbol. They accomplish two things: @@ -103,9 +103,7 @@ class Person is converted to the lambda [ :x | self.val = x ] */ - $ exampleProperty - get => self.val, - set => self.val = value. + $ exampleProperty | get => self.val, set => self.val = value. /* Without the lambda synthesis, the property would look like this: Note that this is the only time it is legal to access private fields @@ -120,8 +118,7 @@ class Person If either the `set` or `get` elements are not provided, the property becomes read-only or write-only respectively */ - $ exampleProperty2 - get => 42. + $ exampleProperty2 | get => 42. /* A property can also be configured to act just like a regular variable, by setting the getter and setters to default implementations.