My favorites
▼
|
Sign in
haxle
A simple signal/slot proof of concept for haXe
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
src
/
GlueTest.hx
‹r14
r18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import org.sugar.sigslot.Glue;
class GlueTest
{
public function new()
{
}
public static function main(): Void
{
var t = new GlueTest();
var o = new Other();
trace('===Simple Example===');
trace('BEFORE');
t.voidArg();
trace('AFTER');
t.voidArg = Glue.joinVoid(t.voidArg, o.voidArg);
t.voidArg();
trace('===Matching Args===');
t.oneArg = Glue.join1(t.oneArg,o.oneArg);
t.oneArg(1);
trace('===Recursive Overrides===');
t.oneArg = Glue.join1(t.oneArg, o.oneArg);
t.oneArg(2);
// this will throw a compiler error, unmatched arity
// t.oneArg = Glue.join1(t.oneArg, o.voidArg);
trace('===Fixing Arity with Closures===');
t.oneArg = Glue.join1(t.oneArg, function(x:Int) { return o.voidArg(); } );
t.oneArg(2);
trace('===Arity only matching===');
// oneArgAlt has a different named argument "y", however it doesn't matter.
t.oneArg = Glue.join1(t.oneArg, o.oneArgAlt);
t.oneArg(3);
}
public dynamic function voidArg() { trace('hi'); }
public dynamic function oneArg(x:Int) { trace('hi '+ x); }
public dynamic function twoArg(x:Int, y:Int) { trace('hi ' + x + ' ' + y); }
}
class Other
{
public function new();
public function voidArg() { trace('other hi'); }
public function oneArg(x:Int) { trace('other hi '+ x); }
public function oneArgAlt(y:Int) { trace('other hi '+ y); }
public function twoArg(x:Int, y:Int) { trace('other hi ' + x + ' ' + y); }
}
Show details
Hide details
Change log
r15
by jdonaldson on Oct 8, 2009
Diff
updated
Go to:
/trunk/src/GlueTest.hx
Project members,
sign in
to write a code review
Older revisions
r14
by jdonaldson on Oct 8, 2009
Diff
Added Glue and GlueTest
All revisions of this file
File info
Size: 1439 bytes, 59 lines
View raw file
Powered by
Google Project Hosting