/* Example of default concurrency for methods of different scopes */
object1 = .subexample~new
say object1~repeat(8, "Object 1 running call 1") /* These calls run */
say object1~repeater(8, "Object 1 running call 2") /* concurrently */
say "Main ended."
exit
::class example
::method repeat
use arg reps,msg
reply "Repeating" msg"," reps "times."
do reps
say msg
end
::class subexample subclass example
::method repeater
use arg reps,msg
reply "Repeating" msg"," reps "times."
do reps
say msg
end
Repeating Object 1 running call 1, 8 times.
Object 1 running call 1
Repeating Object 1 running call 2, 8 times.
Object 1 running call 1
Object 1 running call 2
Main ended.
Object 1 running call 1
Object 1 running call 2
Object 1 running call 1
Object 1 running call 2
Object 1 running call 1
Object 1 running call 2
Object 1 running call 1
Object 1 running call 2
Object 1 running call 1
Object 1 running call 2
Object 1 running call 1
Object 1 running call 2
Object 1 running call 2
/* Example of methods with the same scope not running concurrently*/
object1 = .example~new
say object1~repeat(10,"Object 1 running call 1") /* These calls */
say object1~repeat(10,"Object 1 running call 2") /* cannot run */
say "Main ended." /* concurrently. */
exit
::class example
::method repeat
use arg reps,msg
reply "Repeating" msg"," reps "times."
do reps
say msg
end