2016-03-28 13:27:03 +00:00
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
#include 'Moo.st'.
|
2016-03-28 13:27:03 +00:00
|
|
|
|
|
|
|
#################################################################
|
|
|
|
## MAIN
|
|
|
|
#################################################################
|
|
|
|
|
|
|
|
## TODO: use #define to define a class or use #class to define a class.
|
|
|
|
## use #extend to extend a class
|
|
|
|
## using #class for both feels confusing.
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
extend Apex
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
extend SmallInteger
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
2017-01-06 09:53:40 +00:00
|
|
|
method getTrue: anInteger
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
^anInteger + 9999.
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method inc
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
^self + 1.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
class TestObject(Object)
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
2017-01-06 09:53:40 +00:00
|
|
|
dcl(#class) Q R.
|
|
|
|
dcl(#classinst) t1 t2.
|
2016-03-28 13:27:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
class MyObject(TestObject)
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
2017-01-06 09:53:40 +00:00
|
|
|
dcl(#class) C B A.
|
2016-03-28 13:27:03 +00:00
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method getTrue
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
^true.
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method getTrue: anInteger
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
^ anInteger
|
|
|
|
}
|
2017-01-06 09:53:40 +00:00
|
|
|
method getFalse
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
^false
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method a { ^ 10 }
|
|
|
|
method b { ^ 20 }
|
|
|
|
method c { ^ 30 }
|
2016-03-28 13:27:03 +00:00
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) a: a b: b c: c
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
^ a + b + c.
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) main
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
| p p2 |
|
|
|
|
'START OF MAIN' dump.
|
|
|
|
##p := [ :a :b :c :d | a dump. b dump. (c + d) dump. ^10. ] newProcessWith: #(abc def 10 20).
|
|
|
|
p := [ :a :b :c :d | a dump. b dump. (c + d) dump. ] newProcessWith: #(abc def 10 20).
|
|
|
|
p2 := [ :a :b :c :d | a dump. b dump. a dump. b dump. (c + d) dump. ^10000 ] newProcessWith: #(
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
|
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
|
|
1000000000000000
|
|
|
|
299999999999999999999999999999999999999999
|
|
|
|
).
|
|
|
|
|
|
|
|
p resume.
|
|
|
|
p2 resume.
|
|
|
|
|
|
|
|
'MIDDLE OF MAIN' dump.
|
|
|
|
Processor activeProcess terminate.
|
|
|
|
|
|
|
|
##p terminate.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
## p resume.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'END OF MAIN' dump.
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|