ruby-contract 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +56 -0
- data/Manifest +85 -0
- data/README +32 -0
- data/TODO +83 -0
- data/doc/classes/Contract.html +599 -0
- data/doc/classes/Contract/Check.html +229 -0
- data/doc/classes/Contract/Check/All.html +172 -0
- data/doc/classes/Contract/Check/Any.html +172 -0
- data/doc/classes/Contract/Check/Block.html +172 -0
- data/doc/classes/Contract/Check/None.html +173 -0
- data/doc/classes/Contract/Check/Quack.html +172 -0
- data/doc/classes/Contract/ContractError.html +151 -0
- data/doc/classes/Contract/ContractException.html +162 -0
- data/doc/classes/Contract/ContractMismatch.html +134 -0
- data/doc/classes/Kernel.html +256 -0
- data/doc/classes/Method.html +135 -0
- data/doc/classes/MethodSignatureMixin.html +208 -0
- data/doc/classes/Module.html +526 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +14 -0
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_1.dot +14 -0
- data/doc/dot/f_1.png +0 -0
- data/doc/dot/f_2.dot +14 -0
- data/doc/dot/f_2.png +0 -0
- data/doc/dot/f_3.dot +112 -0
- data/doc/dot/f_3.png +0 -0
- data/doc/dot/f_4.dot +62 -0
- data/doc/dot/f_4.png +0 -0
- data/doc/dot/f_5.dot +62 -0
- data/doc/dot/f_5.png +0 -0
- data/doc/dot/f_6.dot +224 -0
- data/doc/dot/f_6.png +0 -0
- data/doc/dot/f_6_0.dot +24 -0
- data/doc/dot/f_6_0.png +0 -0
- data/doc/dot/f_6_1.dot +24 -0
- data/doc/dot/f_6_1.png +0 -0
- data/doc/dot/f_7.dot +62 -0
- data/doc/dot/f_7.png +0 -0
- data/doc/files/COPYING.html +168 -0
- data/doc/files/README.html +146 -0
- data/doc/files/TODO.html +240 -0
- data/doc/files/lib/contract/assertions_rb.html +118 -0
- data/doc/files/lib/contract/exception_rb.html +125 -0
- data/doc/files/lib/contract/integration_rb.html +130 -0
- data/doc/files/lib/contract/overrides_rb.html +118 -0
- data/doc/files/lib/contract_rb.html +127 -0
- data/doc/fr_class_index.html +40 -0
- data/doc/fr_file_index.html +34 -0
- data/doc/fr_method_index.html +45 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/contract.rb +146 -0
- data/lib/contract/assertions.rb +42 -0
- data/lib/contract/exception.rb +95 -0
- data/lib/contract/integration.rb +664 -0
- data/lib/contract/overrides.rb +41 -0
- data/setup.rb +1360 -0
- data/test/coverage/_-lib-contract-assertions_rb.html +526 -0
- data/test/coverage/_-lib-contract-exception_rb.html +632 -0
- data/test/coverage/_-lib-contract-integration_rb.html +1450 -0
- data/test/coverage/_-lib-contract-overrides_rb.html +524 -0
- data/test/coverage/_-lib-contract_rb.html +724 -0
- data/test/coverage/__-lib-contract-assertions_rb.html +484 -0
- data/test/coverage/__-lib-contract-exception_rb.html +537 -0
- data/test/coverage/__-lib-contract-integration_rb.html +946 -0
- data/test/coverage/__-lib-contract-overrides_rb.html +483 -0
- data/test/coverage/__-lib-contract_rb.html +583 -0
- data/test/coverage/index.html +93 -0
- data/test/tc_all.rb +8 -0
- data/test/tc_contract.rb +109 -0
- data/test/tc_exception.rb +43 -0
- data/test/tc_integration.rb +357 -0
- metadata +136 -0
data/doc/dot/f_6.png
ADDED
Binary file
|
data/doc/dot/f_6_0.dot
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
digraph TopLevel {
|
2
|
+
compound = true
|
3
|
+
bgcolor = lightcyan1
|
4
|
+
fontname = Arial
|
5
|
+
fontsize = 8
|
6
|
+
label = "MethodSignatureMixin"
|
7
|
+
node [
|
8
|
+
fontname = Arial,
|
9
|
+
fontsize = 8,
|
10
|
+
color = black
|
11
|
+
]
|
12
|
+
|
13
|
+
subgraph cluster_MethodSignatureMixin {
|
14
|
+
fillcolor = palegreen1
|
15
|
+
URL = "classes/MethodSignatureMixin.html"
|
16
|
+
fontname = Arial
|
17
|
+
color = blue
|
18
|
+
label = "MethodSignatureMixin"
|
19
|
+
style = filled
|
20
|
+
|
21
|
+
}
|
22
|
+
|
23
|
+
}
|
24
|
+
|
data/doc/dot/f_6_0.png
ADDED
Binary file
|
data/doc/dot/f_6_1.dot
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
digraph TopLevel {
|
2
|
+
compound = true
|
3
|
+
bgcolor = lightcyan1
|
4
|
+
fontname = Arial
|
5
|
+
fontsize = 8
|
6
|
+
label = "Kernel"
|
7
|
+
node [
|
8
|
+
fontname = Arial,
|
9
|
+
fontsize = 8,
|
10
|
+
color = black
|
11
|
+
]
|
12
|
+
|
13
|
+
subgraph cluster_Kernel {
|
14
|
+
fillcolor = palegreen1
|
15
|
+
URL = "classes/Kernel.html"
|
16
|
+
fontname = Arial
|
17
|
+
color = blue
|
18
|
+
label = "Kernel"
|
19
|
+
style = filled
|
20
|
+
|
21
|
+
}
|
22
|
+
|
23
|
+
}
|
24
|
+
|
data/doc/dot/f_6_1.png
ADDED
Binary file
|
data/doc/dot/f_7.dot
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
digraph TopLevel {
|
2
|
+
compound = true
|
3
|
+
bgcolor = lightcyan1
|
4
|
+
fontname = Arial
|
5
|
+
fontsize = 8
|
6
|
+
label = "lib/contract.rb"
|
7
|
+
node [
|
8
|
+
fontname = Arial,
|
9
|
+
fontsize = 8,
|
10
|
+
color = black
|
11
|
+
]
|
12
|
+
|
13
|
+
Contract [
|
14
|
+
fontcolor = black,
|
15
|
+
URL = "classes/Contract.html",
|
16
|
+
shape = ellipse,
|
17
|
+
color = palegoldenrod,
|
18
|
+
style = filled,
|
19
|
+
label = "Contract"
|
20
|
+
]
|
21
|
+
|
22
|
+
Test__Unit__TestCase [
|
23
|
+
URL = none,
|
24
|
+
label = "Test::Unit::TestCase"
|
25
|
+
]
|
26
|
+
|
27
|
+
Test__Unit__TestCase -> Contract [
|
28
|
+
|
29
|
+
]
|
30
|
+
|
31
|
+
subgraph cluster_Contract__ContractException {
|
32
|
+
fillcolor = palegreen3
|
33
|
+
URL = "classes/Contract/ContractException.html"
|
34
|
+
fontname = Arial
|
35
|
+
color = blue
|
36
|
+
label = "Contract::ContractException"
|
37
|
+
style = filled
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
subgraph cluster_Contract__Check {
|
42
|
+
fillcolor = palegreen3
|
43
|
+
URL = "classes/Contract/Check.html"
|
44
|
+
fontname = Arial
|
45
|
+
color = blue
|
46
|
+
label = "Contract::Check"
|
47
|
+
style = filled
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
subgraph cluster_Contract__SuiteMixin {
|
52
|
+
fillcolor = palegreen3
|
53
|
+
URL = "classes/Contract/SuiteMixin.html"
|
54
|
+
fontname = Arial
|
55
|
+
color = blue
|
56
|
+
label = "Contract::SuiteMixin"
|
57
|
+
style = filled
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
}
|
62
|
+
|
data/doc/dot/f_7.png
ADDED
Binary file
|
@@ -0,0 +1,168 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: COPYING</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>COPYING</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>COPYING
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Feb 11 19:25:26 Westeurop�ische Normalzeit 2005</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
<div id="diagram">
|
71
|
+
<map id="map" name="map">
|
72
|
+
</map>
|
73
|
+
<img src="../dot/f_1.png" usemap="#map" border=0 alt="COPYING">
|
74
|
+
</div>
|
75
|
+
|
76
|
+
<div id="description">
|
77
|
+
<p>
|
78
|
+
ruby-contract is copyrighted free software by Florian Gross
|
79
|
+
<flgr@ccan.de>. You can redistribute it and/or modify it under either
|
80
|
+
the terms of the GPL (see the file GPL), or the conditions below:
|
81
|
+
</p>
|
82
|
+
<pre>
|
83
|
+
1. You may make and give away verbatim copies of the source form of the
|
84
|
+
software without restriction, provided that you duplicate all of the
|
85
|
+
original copyright notices and associated disclaimers.
|
86
|
+
|
87
|
+
2. You may modify your copy of the software in any way, provided that
|
88
|
+
you do at least ONE of the following:
|
89
|
+
|
90
|
+
a) place your modifications in the Public Domain or otherwise
|
91
|
+
make them Freely Available, such as by posting said
|
92
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
93
|
+
the author to include your modifications in the software.
|
94
|
+
|
95
|
+
b) use the modified software only within your corporation or
|
96
|
+
organization.
|
97
|
+
|
98
|
+
c) give non-standard binaries non-standard names, with
|
99
|
+
instructions on where to get the original software distribution.
|
100
|
+
|
101
|
+
d) make other distribution arrangements with the author.
|
102
|
+
|
103
|
+
3. You may distribute the software in object code or binary form,
|
104
|
+
provided that you do at least ONE of the following:
|
105
|
+
|
106
|
+
a) distribute the binaries and library files of the software,
|
107
|
+
together with instructions (in the manual page or equivalent)
|
108
|
+
on where to get the original distribution.
|
109
|
+
|
110
|
+
b) accompany the distribution with the machine-readable source of
|
111
|
+
the software.
|
112
|
+
|
113
|
+
c) give non-standard binaries non-standard names, with
|
114
|
+
instructions on where to get the original software distribution.
|
115
|
+
|
116
|
+
d) make other distribution arrangements with the author.
|
117
|
+
|
118
|
+
4. You may modify and include the part of the software into any other
|
119
|
+
software (possibly commercial). But some files in the distribution
|
120
|
+
are not written by the author, so that they are not under these terms.
|
121
|
+
|
122
|
+
For the list of those files and their copying conditions, see the
|
123
|
+
file LEGAL.
|
124
|
+
|
125
|
+
5. The scripts and library files supplied as input to or produced as
|
126
|
+
output from the software do not automatically fall under the
|
127
|
+
copyright of the software, but belong to whomever generated them,
|
128
|
+
and may be sold commercially, and may be aggregated with this
|
129
|
+
software.
|
130
|
+
|
131
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
132
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
133
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
134
|
+
PURPOSE.
|
135
|
+
</pre>
|
136
|
+
|
137
|
+
</div>
|
138
|
+
|
139
|
+
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
<!-- if includes -->
|
147
|
+
|
148
|
+
<div id="section">
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<!-- if method_list -->
|
158
|
+
|
159
|
+
|
160
|
+
</div>
|
161
|
+
|
162
|
+
|
163
|
+
<div id="validator-badges">
|
164
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
</body>
|
168
|
+
</html>
|
@@ -0,0 +1,146 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: README</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>README</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Tue Feb 15 02:19:20 Westeurop�ische Normalzeit 2005</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
<div id="diagram">
|
71
|
+
<map id="map" name="map">
|
72
|
+
</map>
|
73
|
+
<img src="../dot/f_2.png" usemap="#map" border=0 alt="README">
|
74
|
+
</div>
|
75
|
+
|
76
|
+
<div id="description">
|
77
|
+
<h1>ruby-contract 0.1.1 README</h1>
|
78
|
+
<p>
|
79
|
+
ruby-contract provides support for describing and using types via
|
80
|
+
unit-tests. It offers support for specifying contracts (<a
|
81
|
+
href="../classes/Contract.html">Contract</a>), method signature checks (<a
|
82
|
+
href="../classes/Module.html#M000015">Module#signature</a>), automatic
|
83
|
+
adaption between types (<a
|
84
|
+
href="../classes/Kernel.html#M000019">Kernel#adaption</a>) and integration
|
85
|
+
with the classic message- and class-based typing.
|
86
|
+
</p>
|
87
|
+
<h2>Requirements</h2>
|
88
|
+
<ul>
|
89
|
+
<li>Ruby >= 1.8.1
|
90
|
+
|
91
|
+
</li>
|
92
|
+
</ul>
|
93
|
+
<h2>Installation</h2>
|
94
|
+
<p>
|
95
|
+
De-compress archive and enter its top directory. Then type:
|
96
|
+
</p>
|
97
|
+
<pre>
|
98
|
+
($ su)
|
99
|
+
# ruby setup.rb
|
100
|
+
</pre>
|
101
|
+
<p>
|
102
|
+
These simple step installs this program under the default location of Ruby
|
103
|
+
libraries. You can also install files into your favorite directory by
|
104
|
+
supplying setup.rb some options. Try "ruby setup.rb —help".
|
105
|
+
</p>
|
106
|
+
<h2>License</h2>
|
107
|
+
<p>
|
108
|
+
Dual licensed under GPL and Ruby’s custom license. See COPYING.
|
109
|
+
</p>
|
110
|
+
<h2>Author</h2>
|
111
|
+
<p>
|
112
|
+
Florian Gross, flgr@ccan.de
|
113
|
+
</p>
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
<!-- if includes -->
|
125
|
+
|
126
|
+
<div id="section">
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<!-- if method_list -->
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
<div id="validator-badges">
|
142
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
</body>
|
146
|
+
</html>
|
data/doc/files/TODO.html
ADDED
@@ -0,0 +1,240 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: TODO</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>TODO</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>TODO
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Tue Feb 15 02:09:44 Westeurop�ische Normalzeit 2005</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
<div id="diagram">
|
71
|
+
<map id="map" name="map">
|
72
|
+
</map>
|
73
|
+
<img src="../dot/f_0.png" usemap="#map" border=0 alt="TODO">
|
74
|
+
</div>
|
75
|
+
|
76
|
+
<div id="description">
|
77
|
+
<h1>TODO</h1>
|
78
|
+
<ul>
|
79
|
+
<li>Also think about how to extend the DBC abilities. Invariants would be nice,
|
80
|
+
but how to implement them?
|
81
|
+
|
82
|
+
</li>
|
83
|
+
<li>Add multi method dispatch facilities similar to those from dispatch.rb. It
|
84
|
+
would be good if code could be shared between that and signatures.
|
85
|
+
|
86
|
+
</li>
|
87
|
+
<li>Write introductionary explanation of what we do and don’t and why we
|
88
|
+
do so. Probably belongs into the README but should also appear in the RDoc
|
89
|
+
output. <a
|
90
|
+
href="http://split-s.blogspot.com/2005/02/quack-quack.html">split-s.blogspot.com/2005/02/quack-quack.html</a>
|
91
|
+
might be useful for explaining why this is better than doing the usual is-a
|
92
|
+
typing of static languages.
|
93
|
+
|
94
|
+
</li>
|
95
|
+
<li>Perhaps teach the Rakefile how to export the SVN tree to the RubyForge
|
96
|
+
project (see <a href="http://svn2cvs.tigris.org">svn2cvs.tigris.org</a>/)
|
97
|
+
|
98
|
+
</li>
|
99
|
+
<li>If we add DBC we probably ought to have ways of getting the pre and post
|
100
|
+
checks as well as the in-variants as an Array of Procs or something like
|
101
|
+
that.
|
102
|
+
|
103
|
+
</li>
|
104
|
+
<li>Make Method#signature return a meta object that allows you to do
|
105
|
+
method.signature.matches?(*args) or something similar?
|
106
|
+
|
107
|
+
</li>
|
108
|
+
</ul>
|
109
|
+
<h1>Done</h1>
|
110
|
+
<ul>
|
111
|
+
<li>Add methods for querying signature meta information.
|
112
|
+
(Unbound)Method#signature would return the original <a
|
113
|
+
href="../classes/Module.html#M000015">Module#signature</a> arguments.
|
114
|
+
|
115
|
+
</li>
|
116
|
+
<li>Set up a RubyForge project and teach the Rakefile how to upload releases
|
117
|
+
|
118
|
+
</li>
|
119
|
+
<li>Contact the pragprog guys about DBC in Ruby: <a
|
120
|
+
href="http://www.eng.cse.dmu.ac.uk/~hgs/projects/ruby_dbc.html">www.eng.cse.dmu.ac.uk/~hgs/projects/ruby_dbc.html</a>
|
121
|
+
|
122
|
+
<ul>
|
123
|
+
<li>Done, might base post/pre-conditions implementation on that project
|
124
|
+
|
125
|
+
</li>
|
126
|
+
</ul>
|
127
|
+
</li>
|
128
|
+
<li>Think about the kind of object adaption that matz discussed on his weblog:
|
129
|
+
<a
|
130
|
+
href="http://redhanded.hobix.com/inspect/staticTyping.html">redhanded.hobix.com/inspect/staticTyping.html</a>
|
131
|
+
Also see <a
|
132
|
+
href="http://www.python.org/peps/pep-0246.html">www.python.org/peps/pep-0246.html</a>
|
133
|
+
and <a
|
134
|
+
href="http://peak.telecommunity.com/DevCenter/MonkeyTyping">peak.telecommunity.com/DevCenter/MonkeyTyping</a>
|
135
|
+
|
136
|
+
<pre>
|
137
|
+
adaption :from => Pathname, :to => String, :via => :to_str
|
138
|
+
adaption :from => String, :to => Pathname do |string|
|
139
|
+
Pathname.new(string)
|
140
|
+
end
|
141
|
+
adaption :from => String, :to => Pathname, :via => Pathname.method(:new)
|
142
|
+
</pre>
|
143
|
+
<p>
|
144
|
+
Perhaps make both :from and :to default to self so short forms are possible
|
145
|
+
inside classes: (raise Exception when :to == :from)
|
146
|
+
</p>
|
147
|
+
<pre>
|
148
|
+
class String
|
149
|
+
adaption :to => Pathname, :via => Pathname.method(:new)
|
150
|
+
adaption :from => Pathname, :via => :to_str
|
151
|
+
|
152
|
+
adaption :to => Symbol, :via => :to_sym
|
153
|
+
end
|
154
|
+
</pre>
|
155
|
+
<p>
|
156
|
+
Might be nice to have conditional adaption routes:
|
157
|
+
</p>
|
158
|
+
<pre>
|
159
|
+
class Object
|
160
|
+
adaption :to => String, :via => :to_str, :if => Contract::Check::Quack[:to_str]
|
161
|
+
# perhaps also introduce this short form
|
162
|
+
adaption :to => String, :via => :to_str, :if => :to_str
|
163
|
+
end
|
164
|
+
</pre>
|
165
|
+
<p>
|
166
|
+
Perhaps :if should default to :via if :via is a Symbol which would allow
|
167
|
+
the above to become
|
168
|
+
</p>
|
169
|
+
<pre>
|
170
|
+
class Object
|
171
|
+
adaption :to => String, :via => :to_str
|
172
|
+
end
|
173
|
+
</pre>
|
174
|
+
<ul>
|
175
|
+
<li>Implemented.
|
176
|
+
|
177
|
+
</li>
|
178
|
+
</ul>
|
179
|
+
</li>
|
180
|
+
<li>Think about implementing <a
|
181
|
+
href="../classes/Contract.html#M000008">Contract#implies</a> which would
|
182
|
+
automatically trigger the inclusion of a <a
|
183
|
+
href="../classes/Module.html">Module</a> on other Modules/Classes that do
|
184
|
+
fulfills(contract).
|
185
|
+
|
186
|
+
<ul>
|
187
|
+
<li>Implemented.
|
188
|
+
|
189
|
+
</li>
|
190
|
+
</ul>
|
191
|
+
</li>
|
192
|
+
<li><a href="../classes/Module.html#M000016">Module#fulfills</a>(contract)
|
193
|
+
— a way of stating that all instances of a Class should be checked
|
194
|
+
against the contract after initialisation. This would always need to be
|
195
|
+
called after defining a custom initialize().
|
196
|
+
|
197
|
+
</li>
|
198
|
+
<li>Read <a
|
199
|
+
href="http://www.smalltalk.org/articles">www.smalltalk.org/articles</a>/
|
200
|
+
|
201
|
+
<ul>
|
202
|
+
<li>Has a few generic comments about static typing and dynamic typing.
|
203
|
+
|
204
|
+
</li>
|
205
|
+
</ul>
|
206
|
+
</li>
|
207
|
+
</ul>
|
208
|
+
|
209
|
+
</div>
|
210
|
+
|
211
|
+
|
212
|
+
</div>
|
213
|
+
|
214
|
+
|
215
|
+
</div>
|
216
|
+
|
217
|
+
|
218
|
+
<!-- if includes -->
|
219
|
+
|
220
|
+
<div id="section">
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<!-- if method_list -->
|
230
|
+
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
|
235
|
+
<div id="validator-badges">
|
236
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
</body>
|
240
|
+
</html>
|