2016-03-28 13:27:03 +00:00
|
|
|
|
|
|
|
#include 'Stix.st'.
|
|
|
|
|
|
|
|
#################################################################
|
|
|
|
## 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) a1 a2.
|
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
|
|
|
{
|
|
|
|
#declare(#classinst) t1 t2.
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) xxxx
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
| g1 g2 |
|
|
|
|
t1 dump.
|
|
|
|
t2 := [ g1 := 50. g2 := 100. ^g1 + g2 ].
|
|
|
|
(t1 < 100) ifFalse: [ ^self ].
|
|
|
|
t1 := t1 + 1.
|
|
|
|
^self xxxx.
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) zzz
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
'zzzzzzzzzzzzzzzzzz' dump.
|
|
|
|
^self.
|
|
|
|
}
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) yyy
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
^[123456789 dump. ^200].
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) main2
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
'START OF MAIN2' dump.
|
|
|
|
##[thisContext dump. ^100] newProcess resume.
|
|
|
|
[ |k| thisContext dump. self zzz. "k := self yyy. k value." ['ok' dump. ^100] value] newProcess resume.
|
|
|
|
'1111' dump.
|
|
|
|
'1111' dump.
|
|
|
|
'1111' dump.
|
|
|
|
'1111' dump.
|
|
|
|
'1111' dump.
|
|
|
|
'EDN OF MAIN2' dump.
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) main1
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
'START OF MAIN1' dump.
|
|
|
|
self main2.
|
|
|
|
'END OF MAIN1' dump.
|
|
|
|
}
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method(#class) main
|
2016-03-28 13:27:03 +00:00
|
|
|
{
|
|
|
|
'START OF MAIN' dump.
|
|
|
|
self main1.
|
|
|
|
'EDN OF MAIN' dump.
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|