doc: add ! message handler terminator token

This commit is contained in:
2024-11-10 12:20:44 +00:00
parent 0603b2f52a
commit acfc811a38

View File

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