2016-03-28 13:27:03 +00:00
|
|
|
|
2017-01-09 12:52:37 +00:00
|
|
|
#include 'Moo.moo'.
|
2016-03-28 13:27:03 +00:00
|
|
|
|
2019-06-27 06:29:09 +00:00
|
|
|
////////////////////////////////////////////////////////////////#
|
|
|
|
// MAIN
|
|
|
|
////////////////////////////////////////////////////////////////#
|
2016-03-28 13:27:03 +00:00
|
|
|
|
2019-06-27 06:29:09 +00:00
|
|
|
// 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.
|
2016-03-28 13:27:03 +00:00
|
|
|
|
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-04-24 09:20:27 +00:00
|
|
|
var(#class) Q, R.
|
|
|
|
var(#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-04-24 09:20:27 +00:00
|
|
|
var(#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.
|
2019-06-27 06:29:09 +00:00
|
|
|
//p := [ :a :b :c :d | a dump. b dump. (c + d) dump. ^10. ] newProcessWith: #(#abc #def 10 20).
|
2017-04-24 09:20:27 +00:00
|
|
|
p := [ :a :b :c :d | a dump. b dump. (c + d) dump. ] newProcessWith: #(#abc #def 10 20).
|
2016-03-28 13:27:03 +00:00
|
|
|
p2 := [ :a :b :c :d | a dump. b dump. a dump. b dump. (c + d) dump. ^10000 ] newProcessWith: #(
|
2017-04-24 09:20:27 +00:00
|
|
|
#AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
|
#BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
2016-03-28 13:27:03 +00:00
|
|
|
1000000000000000
|
|
|
|
299999999999999999999999999999999999999999
|
|
|
|
).
|
|
|
|
|
|
|
|
p resume.
|
|
|
|
p2 resume.
|
|
|
|
|
|
|
|
'MIDDLE OF MAIN' dump.
|
|
|
|
Processor activeProcess terminate.
|
|
|
|
|
2019-06-27 06:29:09 +00:00
|
|
|
//p terminate.
|
2016-03-28 13:27:03 +00:00
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
2019-06-27 06:29:09 +00:00
|
|
|
// p resume.
|
2016-03-28 13:27:03 +00:00
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'999999999999999999' dump.
|
|
|
|
'END OF MAIN' dump.
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|