Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 846 lines (756 sloc) 20.838 kb
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
1 my knowhow NQPStr is repr('P6str') {
2f806d3b »
2010-08-17 Here starteth the NQP setting.
2 method new() {
3 nqp::instance_of(self.WHAT);
4 }
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
5 method Bool() {
3881965d »
2010-08-21 Turns out that the always pass ops type object for result type strate…
6 nqp::logical_not_int(nqp::equal_strs(self, "")) &&
7 nqp::logical_not_int(nqp::equal_strs(self, "0"))
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
8 }
ebb368a9 »
2010-10-19 [common] NQPArray.bind_pos plus some missing coercion methods.
9 method Int() {
10 nqp::coerce_str_to_int(self, NQPInt)
11 }
12 method Num() {
13 nqp::coerce_str_to_num(self, NQPNum)
14 }
cf07e791 »
2010-10-18 [common] Some initial cuts of prefix + and ~, Stringy and Numeric in …
15 method Numeric() {
16 nqp::coerce_str_to_num(self, NQPNum)
17 }
8c6b5aef »
2010-08-17 Add Str methods to setting for NQPNum and NQPInt.
18 method Str() {
3e7ec365 »
2010-08-21 A little setting re-ordering; put NQPStr first, since we need strings…
19 self
8c6b5aef »
2010-08-17 Add Str methods to setting for NQPNum and NQPInt.
20 }
cf07e791 »
2010-10-18 [common] Some initial cuts of prefix + and ~, Stringy and Numeric in …
21 method Stringy() {
22 self
23 }
ac08da5d »
2010-10-29 [common] Add .defined methods to the various built-in types.
24 method defined() {
25 nqp::repr_defined(self)
26 }
2bceca45 »
2010-11-22 [dotnet] make regex Actions generate method not sub
27 method ACCEPTS($target) {
28 my $what := self;
29 $what.isa($target, $what);
30 }
2f806d3b »
2010-08-17 Here starteth the NQP setting.
31 }
32
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
33 my knowhow NQPInt is repr('P6int') {
2f806d3b »
2010-08-17 Here starteth the NQP setting.
34 method new() {
35 nqp::instance_of(self.WHAT);
36 }
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
37 method Bool() {
3881965d »
2010-08-21 Turns out that the always pass ops type object for result type strate…
38 nqp::logical_not_int(nqp::equal_ints(self, 0))
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
39 }
3e7ec365 »
2010-08-21 A little setting re-ordering; put NQPStr first, since we need strings…
40 method Int() {
2f806d3b »
2010-08-17 Here starteth the NQP setting.
41 self
42 }
3e7ec365 »
2010-08-21 A little setting re-ordering; put NQPStr first, since we need strings…
43 method Num() {
44 nqp::coerce_int_to_num(self, NQPNum)
45 }
cf07e791 »
2010-10-18 [common] Some initial cuts of prefix + and ~, Stringy and Numeric in …
46 method Numeric() {
47 self
48 }
3e7ec365 »
2010-08-21 A little setting re-ordering; put NQPStr first, since we need strings…
49 method Str() {
50 nqp::coerce_int_to_str(self, NQPStr)
51 }
cf07e791 »
2010-10-18 [common] Some initial cuts of prefix + and ~, Stringy and Numeric in …
52 method Stringy() {
53 nqp::coerce_int_to_str(self, NQPStr)
54 }
ac08da5d »
2010-10-29 [common] Add .defined methods to the various built-in types.
55 method defined() {
56 nqp::repr_defined(self)
57 }
2f806d3b »
2010-08-17 Here starteth the NQP setting.
58 }
59
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
60 my knowhow NQPNum is repr('P6num') {
2f806d3b »
2010-08-17 Here starteth the NQP setting.
61 method new() {
62 nqp::instance_of(self.WHAT);
63 }
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
64 method Bool() {
3881965d »
2010-08-21 Turns out that the always pass ops type object for result type strate…
65 nqp::logical_not_int(nqp::equal_nums(self, 0.0))
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
66 }
67 method Int() {
68 nqp::coerce_num_to_int(self, NQPStr)
69 }
2f806d3b »
2010-08-17 Here starteth the NQP setting.
70 method Num() {
71 self
72 }
cf07e791 »
2010-10-18 [common] Some initial cuts of prefix + and ~, Stringy and Numeric in …
73 method Numeric() {
74 self
75 }
8c6b5aef »
2010-08-17 Add Str methods to setting for NQPNum and NQPInt.
76 method Str() {
77 nqp::coerce_num_to_str(self, NQPStr)
78 }
cf07e791 »
2010-10-18 [common] Some initial cuts of prefix + and ~, Stringy and Numeric in …
79 method Stringy() {
80 nqp::coerce_num_to_str(self, NQPStr)
81 }
ac08da5d »
2010-10-29 [common] Add .defined methods to the various built-in types.
82 method defined() {
83 nqp::repr_defined(self)
84 }
2f806d3b »
2010-08-17 Here starteth the NQP setting.
85 }
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
86
2fd812db »
2010-10-31 [dotnet] Make sure at_pos and at_key never return null, but rather so…
87 # XXX Bad hack, we'll replace this later.
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
88 my knowhow Any {
2fd812db »
2010-10-31 [dotnet] Make sure at_pos and at_key never return null, but rather so…
89 method defined() { 0 }
05d65c97 »
2010-11-28 [dotnet] fix last commit
90 method Num() { nqp::coerce_int_to_num(0, NQPNum) }
8709bf41 »
2010-11-28 [dotnet] add .Num and .Int to knowhow Any in NQPSetting
91 method Int() { 0 }
1f4a978d »
2010-11-29 [common NQPSetting] Add a Bool method to Any
92 method Bool() { 0 }
2fd812db »
2010-10-31 [dotnet] Make sure at_pos and at_key never return null, but rather so…
93 }
94
08510b7d »
2010-11-13 [common] Add an NQPMapIter that just knows how to eagerly reify a lis…
95 my knowhow NQPMapIter {
96 has $!block;
97 has @!list;
98 method new($block, @list) {
99 my $iter := nqp::instance_of(self.WHAT);
100 $iter.BUILD($block, @list);
101 $iter
102 }
103 method BUILD($block, @list) {
104 $!block := $block;
105 @!list := @list;
106 }
107 method eager() {
108 my $i := 0;
109 my $elems := +@!list;
110 my @result;
111 while $i < $elems {
112 @result.push($!block(@!list[$i]));
113 $i := $i + 1;
114 }
115 @result
116 }
117 }
118
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
119 my knowhow NQPList is repr('P6list') {
7e36dac7 »
2010-10-18 Give NQPList a .new method.
120 method new() {
121 nqp::instance_of(self.WHAT)
122 }
d88a87b1 »
2010-09-13 Flesh out NQPList a little bit.
123 method elems() {
124 nqp::lllist_elems(self)
125 }
ea3a9cb5 »
2010-10-19 [common] Lists and arrays numify to number of elements.
126 method Numeric() {
127 self.elems
128 }
d88a87b1 »
2010-09-13 Flesh out NQPList a little bit.
129 method at_pos($idx) {
2fd812db »
2010-10-31 [dotnet] Make sure at_pos and at_key never return null, but rather so…
130 nqp::vivify(nqp::lllist_get_at_pos(self, $idx.Int), Any)
d88a87b1 »
2010-09-13 Flesh out NQPList a little bit.
131 }
ac08da5d »
2010-10-29 [common] Add .defined methods to the various built-in types.
132 method defined() {
133 nqp::repr_defined(self)
134 }
08510b7d »
2010-11-13 [common] Add an NQPMapIter that just knows how to eagerly reify a lis…
135 method map($block) {
136 NQPMapIter.new($block, self)
137 }
eae223f3 »
2010-08-22 Add a first cut of a P6list representation and a list sub that makes …
138 }
139
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
140 my knowhow NQPArray is repr('P6list') {
7e36dac7 »
2010-10-18 Give NQPList a .new method.
141 method new() {
142 nqp::instance_of(self.WHAT)
143 }
ea3a9cb5 »
2010-10-19 [common] Lists and arrays numify to number of elements.
144 method Numeric() {
145 self.elems
146 }
c6db91a2 »
2010-11-30 [dotnet] more regex progress.
147 method Stringy() {
148 my $res := '';
149 for self {
150 $res := $res ~ ' ' ~ ~$_
151 }
152 $res
153 }
7e36dac7 »
2010-10-18 Give NQPList a .new method.
154 method elems() {
155 nqp::lllist_elems(self)
156 }
e7e4edb4 »
2010-10-31 [dotnet] implement push, pop, unshift, shift in NQPArray
157 method pop() {
158 nqp::lllist_pop(self)
159 }
160 method push($item) {
161 nqp::lllist_push(self, $item)
162 }
163 method shift() {
164 nqp::lllist_shift(self)
165 }
166 method unshift($item) {
167 nqp::lllist_unshift(self, $item)
168 }
7e36dac7 »
2010-10-18 Give NQPList a .new method.
169 method at_pos($idx) {
2fd812db »
2010-10-31 [dotnet] Make sure at_pos and at_key never return null, but rather so…
170 nqp::vivify(nqp::lllist_get_at_pos(self, $idx.Int), Any)
7e36dac7 »
2010-10-18 Give NQPList a .new method.
171 }
ebb368a9 »
2010-10-19 [common] NQPArray.bind_pos plus some missing coercion methods.
172 method bind_pos($idx, $value) {
173 nqp::lllist_bind_at_pos(self, $idx.Int, $value)
174 }
ac08da5d »
2010-10-29 [common] Add .defined methods to the various built-in types.
175 method defined() {
176 nqp::repr_defined(self)
177 }
08510b7d »
2010-11-13 [common] Add an NQPMapIter that just knows how to eagerly reify a lis…
178 method map($block) {
179 NQPMapIter.new($block, self)
180 }
eae223f3 »
2010-08-22 Add a first cut of a P6list representation and a list sub that makes …
181 }
182
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
183 my knowhow NQPHash is repr('P6mapping') {
435bd243 »
2010-10-20 [common] Stub in NQPHash. Doesn't do anything yet other that .new.
184 method new() {
185 nqp::instance_of(self.WHAT)
186 }
88190a82 »
2010-10-20 [common] Fill out NQPHash a bit and...we have basically functioning h…
187 method Numeric() {
188 self.elems
189 }
190 method elems() {
191 nqp::llmapping_elems(self)
192 }
193 method at_key($key) {
2fd812db »
2010-10-31 [dotnet] Make sure at_pos and at_key never return null, but rather so…
194 nqp::vivify(nqp::llmapping_get_at_key(self, $key.Str), Any)
88190a82 »
2010-10-20 [common] Fill out NQPHash a bit and...we have basically functioning h…
195 }
196 method bind_key($key, $value) {
197 nqp::llmapping_bind_at_key(self, $key.Str, $value)
198 }
ac08da5d »
2010-10-29 [common] Add .defined methods to the various built-in types.
199 method defined() {
200 nqp::repr_defined(self)
201 }
435bd243 »
2010-10-20 [common] Stub in NQPHash. Doesn't do anything yet other that .new.
202 }
203
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
204 my knowhow NQPCode is repr('RakudoCodeRef') {
3c156f0c »
2010-10-22 [common] Add a NQPCode with a leave method.
205 method leave($with) {
206 nqp::leave_block(self, $with)
207 }
ac08da5d »
2010-10-29 [common] Add .defined methods to the various built-in types.
208 method defined() {
209 nqp::repr_defined(self)
210 }
3c156f0c »
2010-10-22 [common] Add a NQPCode with a leave method.
211 }
212
1ec27bc4 »
2010-11-19 [dotnet] add NQPCapture knowhow
213 my knowhow NQPCapture is repr('P6capture') {
214 method new() {
215 nqp::instance_of(self.WHAT)
216 }
91a26137 »
2010-11-22 [PAST::Regex] added more regex compiler scaffolding - lots of things …
217 method pos_at($pos) {
1ec27bc4 »
2010-11-19 [dotnet] add NQPCapture knowhow
218 nqp::llcap_get_at_pos(self, $pos)
219 }
91a26137 »
2010-11-22 [PAST::Regex] added more regex compiler scaffolding - lots of things …
220 method key_at($key) {
1ec27bc4 »
2010-11-19 [dotnet] add NQPCapture knowhow
221 nqp::llcap_get_at_key(self, $key)
222 }
223 method bind_pos($pos, $val) {
224 nqp::llcap_bind_at_pos(self, $pos, $val)
225 }
226 method bind_key($key, $val) {
227 nqp::llcap_bind_at_key(self, $key, $val)
228 }
229 }
230
413bae8e »
2010-10-30 [common] Replace explicit multi-dispatcher ops with a proto with a pl…
231 proto sub &infix:<==>($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
232 multi sub &infix:<==>($x, $y) {
233 nqp::equal_nums($x.Num, $y.Num)
234 }
10019acd »
2010-08-23 Start to add multi variants to the NQPSetting. Seems that even though…
235 multi sub &infix:<==>(NQPInt $x, NQPInt $y) {
236 nqp::equal_ints($x, $y)
237 }
238 multi sub &infix:<==>(NQPNum $x, NQPNum $y) {
239 nqp::equal_nums($x, $y)
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
240 }
241
413bae8e »
2010-10-30 [common] Replace explicit multi-dispatcher ops with a proto with a pl…
242 proto sub &infix:<!=>($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
243 multi sub &infix:<!=>($x, $y) {
244 nqp::logical_not_int(nqp::equal_nums($x.Num, $y.Num))
245 }
10019acd »
2010-08-23 Start to add multi variants to the NQPSetting. Seems that even though…
246 multi sub &infix:<!=>(NQPInt $x, NQPInt $y) {
dcf5ee5e »
2010-08-24 Make our != rather more efficient.
247 nqp::logical_not_int(nqp::equal_ints($x, $y))
10019acd »
2010-08-23 Start to add multi variants to the NQPSetting. Seems that even though…
248 }
249 multi sub &infix:<!=>(NQPNum $x, NQPNum $y) {
dcf5ee5e »
2010-08-24 Make our != rather more efficient.
250 nqp::logical_not_int(nqp::equal_nums($x, $y))
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
251 }
252
ee58ecd6 »
2010-10-31 implemented (copypaste) >,>=,<,<= for NQPInts & NQPNums
253 proto sub &infix:«<=»($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
254 multi sub &infix:«<=»($x, $y) {
255 nqp::less_than_or_equal_nums($x.Num, $y.Num)
256 }
ee58ecd6 »
2010-10-31 implemented (copypaste) >,>=,<,<= for NQPInts & NQPNums
257 multi sub &infix:«<=»(NQPInt $x, NQPInt $y) {
258 nqp::less_than_or_equal_ints($x, $y)
259 }
260 multi sub &infix:«<=»(NQPNum $x, NQPNum $y) {
261 nqp::less_than_or_equal_nums($x, $y)
262 }
263
264 proto sub &infix:«<»($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
265 multi sub &infix:«<»($x, $y) {
266 nqp::less_than_nums($x.Num, $y.Num)
267 }
ee58ecd6 »
2010-10-31 implemented (copypaste) >,>=,<,<= for NQPInts & NQPNums
268 multi sub &infix:«<»(NQPInt $x, NQPInt $y) {
269 nqp::less_than_ints($x, $y)
270 }
271 multi sub &infix:«<»(NQPNum $x, NQPNum $y) {
272 nqp::less_than_nums($x, $y)
273 }
925f29eb »
2010-11-05 [weird] Looks like diakopter++'s commits and my git disagree on line …
274
275 proto sub &infix:«>=»($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
276 multi sub &infix:«>=»($x, $y) {
277 nqp::greater_than_or_equal_nums($x.Num, $y.Num)
278 }
925f29eb »
2010-11-05 [weird] Looks like diakopter++'s commits and my git disagree on line …
279 multi sub &infix:«>=»(NQPInt $x, NQPInt $y) {
280 nqp::greater_than_or_equal_ints($x, $y)
281 }
282 multi sub &infix:«>=»(NQPNum $x, NQPNum $y) {
283 nqp::greater_than_or_equal_nums($x, $y)
284 }
285
286 proto sub &infix:«>»($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
287 multi sub &infix:«>»($x, $y) {
288 nqp::greater_than_nums($x.Num, $y.Num)
289 }
925f29eb »
2010-11-05 [weird] Looks like diakopter++'s commits and my git disagree on line …
290 multi sub &infix:«>»(NQPInt $x, NQPInt $y) {
291 nqp::greater_than_ints($x, $y)
292 }
293 multi sub &infix:«>»(NQPNum $x, NQPNum $y) {
294 nqp::greater_than_nums($x, $y)
295 }
ee58ecd6 »
2010-10-31 implemented (copypaste) >,>=,<,<= for NQPInts & NQPNums
296
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
297 sub &infix:<eq>($x, $y) {
3881965d »
2010-08-21 Turns out that the always pass ops type object for result type strate…
298 nqp::equal_strs($x.Str, $y.Str)
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
299 }
300
301 sub &infix:<ne>($x, $y) {
3881965d »
2010-08-21 Turns out that the always pass ops type object for result type strate…
302 !nqp::equal_strs($x.Str, $y.Str)
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
303 }
304
0d13a6ce »
2010-11-10 [dotnet] implement coercive lt, le, gt, ge; add tests to 10-cmp.t
305 sub &infix:<ge>($x, $y) {
306 nqp::greater_than_or_equal_strs($x.Str, $y.Str)
307 }
308
309 sub &infix:<gt>($x, $y) {
310 nqp::greater_than_strs($x.Str, $y.Str)
311 }
312
313 sub &infix:<le>($x, $y) {
314 nqp::less_than_or_equal_strs($x.Str, $y.Str)
315 }
316
317 sub &infix:<lt>($x, $y) {
318 nqp::less_than_strs($x.Str, $y.Str)
319 }
320
98e707b1 »
2010-10-18 [common] =:=
321 sub &infix:<=:=>($x, $y) {
322 nqp::equal_refs($x, $y)
323 }
324
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
325 sub &prefix:<!>($x) {
3881965d »
2010-08-21 Turns out that the always pass ops type object for result type strate…
326 nqp::logical_not_int($x.Bool)
5e82e893 »
2010-08-18 Fill out the setting with some more coercioin methods and a few equal…
327 }
328
329 sub &prefix:<?>($x) {
330 $x.Bool
331 }
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
332
cf07e791 »
2010-10-18 [common] Some initial cuts of prefix + and ~, Stringy and Numeric in …
333 sub &prefix:<~>($x) {
334 $x.Stringy
335 }
336
337 sub &prefix:<+>($x) {
338 $x.Numeric
339 }
340
413bae8e »
2010-10-30 [common] Replace explicit multi-dispatcher ops with a proto with a pl…
341 proto sub &infix:<+>($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
342 multi sub &infix:<+>($x, $y) {
343 nqp::add_num($x.Num, $y.Num);
344 }
10019acd »
2010-08-23 Start to add multi variants to the NQPSetting. Seems that even though…
345 multi sub &infix:<+>(NQPInt $x, NQPInt $y) {
346 nqp::add_int($x, $y);
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
347 }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
348 multi sub &infix:<+>(NQPNum $x, NQPNum $y) {
349 nqp::add_num($x, $y);
350 }
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
351
413bae8e »
2010-10-30 [common] Replace explicit multi-dispatcher ops with a proto with a pl…
352 proto sub &infix:<->($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
353 multi sub &infix:<->($x, $y) {
354 nqp::sub_num($x.Num, $y.Num);
355 }
10019acd »
2010-08-23 Start to add multi variants to the NQPSetting. Seems that even though…
356 multi sub &infix:<->(NQPInt $x, NQPInt $y) {
357 nqp::sub_int($x, $y);
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
358 }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
359 multi sub &infix:<->(NQPNum $x, NQPNum $y) {
360 nqp::sub_num($x, $y);
361 }
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
362
413bae8e »
2010-10-30 [common] Replace explicit multi-dispatcher ops with a proto with a pl…
363 proto sub &infix:<*>($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
364 multi sub &infix:<*>($x, $y) {
365 nqp::mul_num($x.Num, $y.Num);
366 }
10019acd »
2010-08-23 Start to add multi variants to the NQPSetting. Seems that even though…
367 multi sub &infix:<*>(NQPInt $x, NQPInt $y) {
368 nqp::mul_int($x, $y);
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
369 }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
370 multi sub &infix:<*>(NQPNum $x, NQPNum $y) {
371 nqp::mul_num($x, $y);
372 }
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
373
413bae8e »
2010-10-30 [common] Replace explicit multi-dispatcher ops with a proto with a pl…
374 proto sub &infix:</>($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
375 multi sub &infix:</>($x, $y) {
376 nqp::div_num($x.Num, $y.Num);
377 }
10019acd »
2010-08-23 Start to add multi variants to the NQPSetting. Seems that even though…
378 multi sub &infix:</>(NQPInt $x, NQPInt $y) {
379 nqp::div_int($x, $y);
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
380 }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
381 multi sub &infix:</>(NQPNum $x, NQPNum $y) {
382 nqp::div_num($x, $y);
383 }
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
384
413bae8e »
2010-10-30 [common] Replace explicit multi-dispatcher ops with a proto with a pl…
385 proto sub &infix:<%>($x, $y) { * }
4382f0dc »
2010-11-14 [common] Add various coercice multi variants to various ops, now that…
386 multi sub &infix:<%>($x, $y) {
387 nqp::mod_int($x.Int, $y.Int);
388 }
10019acd »
2010-08-23 Start to add multi variants to the NQPSetting. Seems that even though…
389 multi sub &infix:<%>(NQPInt $x, NQPInt $y) {
390 nqp::mod_int($x, $y);
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
391 }
392
393 sub &infix:<~>($x, $y) {
3881965d »
2010-08-21 Turns out that the always pass ops type object for result type strate…
394 nqp::concat($x.Str, $y.Str);
d3865c1b »
2010-08-18 Add some more operators to the NQP setting.
395 }
a64ea75b »
2010-08-18 Implement plan and ok for getting us more tests.
396
f5cd961b »
2010-11-14 [dotnet] implement bitwise operators for infix NQPInt... can make coe…
397 sub &infix:<+|>(NQPInt $x, NQPInt $y) {
398 nqp::bitwise_or_int($x, $y);
399 }
400 sub &infix:<+&>(NQPInt $x, NQPInt $y) {
401 nqp::bitwise_and_int($x, $y);
402 }
403 sub &infix:<+^>(NQPInt $x, NQPInt $y) {
404 nqp::bitwise_xor_int($x, $y);
405 }
406
6a07cb25 »
2010-10-22 [common] Stub in a simple NQPException exception object and a die sub.
407 # A basic, fairly bare-bones exception object.
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
408 my knowhow NQPException {
6a07cb25 »
2010-10-22 [common] Stub in a simple NQPException exception object and a die sub.
409 has $!message;
410 has $!resumable;
411
412 method new($message) {
413 nqp::instance_of(self.WHAT).BUILD(:message($message))
414 }
415
416 method BUILD(:$message) {
417 $!message := $message;
418 $!resumable := 0;
419 self;
420 }
421
ac08da5d »
2010-10-29 [common] Add .defined methods to the various built-in types.
422 method defined() {
423 nqp::repr_defined(self)
424 }
425
6a07cb25 »
2010-10-22 [common] Stub in a simple NQPException exception object and a die sub.
426 method resumable() {
427 $!resumable
428 }
429
430 method resume() {
431 $!resumable := 1;
432 }
433
434 method Str() {
435 $!message
436 }
437 }
438
439 sub die($message) {
440 nqp::throw_dynamic(NQPException.new($message), 0)
441 }
442
39ec4eca »
2010-11-16 [dotnet] add defined method to Mu
443 sub substr(NQPStr $str, NQPInt $offset, NQPInt $length?) {
91a26137 »
2010-11-22 [PAST::Regex] added more regex compiler scaffolding - lots of things …
444 nqp::repr_defined($length)
445 ?? nqp::substr($str, $offset, $length)
446 !! nqp::substr($str, $offset)
39ec4eca »
2010-11-16 [dotnet] add defined method to Mu
447 }
448
1f4a978d »
2010-11-29 [common NQPSetting] Add a Bool method to Any
449 sub join($joiner, @args) {
450 $joiner := ~$joiner;
451 my $res := "";
452 for @args {
453 $res := $res ~ $joiner ~ ~$_
454 }
455 $res
456 }
457
a64ea75b »
2010-08-18 Implement plan and ok for getting us more tests.
458 # For tests.
459 my $count := NQPInt.new();
460 sub plan($n) {
461 print("1..");
462 say($n);
463 }
7e9d2b8d »
2010-10-21 [common] $diag arg of ok should be optional.
464 sub ok($check, $diag?) {
a64ea75b »
2010-08-18 Implement plan and ok for getting us more tests.
465 $count := $count + 1;
466 unless $check { print("not ") }
467 print("ok ");
468 say($count);
469 }
cbdd49b4 »
2010-10-19 [dotnet] Out with one bad hack, in with a slightly less bad one for u…
470
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
471 # Here comes the start of a heavily under construction ClassHOW.
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
472 my knowhow NQPClassHOW {
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
473 ##
474 ## Attributes
475 ##
476
477 # Name of the class.
478 has $!name;
479
480 # Attributes, methods, parents and roles directly added.
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
481 has @!attributes;
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
482 has %!methods;
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
483 has @!multi_methods_to_incorporate;
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
484 has @!parents;
485 has @!roles;
486
487 # Vtable and mapping of method names to slots.
488 has @!vtable;
489 has %!method-vtable-slots;
490
491 # Have we been composed?
492 has $!composed;
493
494 # Cached MRO (list of the type objects).
495 has @!mro;
496
497 # Full list of roles that we do.
498 has @!done;
499
500 ##
501 ## Declarative.
502 ##
503
504 # Creates a new instance of this meta-class.
b76e0809 »
2010-10-31 [common] Allow NQPClassHOW to take and store the name of the class, a…
505 method new(:$name) {
506 nqp::instance_of(self).BUILD(:name($name))
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
507 }
508
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
509 method CREATE($obj) {
510 nqp::instance_of($obj)
511 }
512
b76e0809 »
2010-10-31 [common] Allow NQPClassHOW to take and store the name of the class, a…
513 method BUILD(:$name) {
514 $!name := $name;
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
515 $!composed := 0;
4356d783 »
2010-10-23 [common] Add a VERY hacky but working version of method addition and …
516 %!methods := NQPHash.new;
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
517 @!multi_methods_to_incorporate := NQPArray.new;
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
518 @!attributes := NQPArray.new;
519 @!parents := NQPArray.new;
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
520 self;
521 }
522
523 # Create a new meta-class instance, and then a new type object
524 # to go with it, and return that.
525 # XXX TODO :$repr named parameter defaulting to P6opaque (don't
526 # have default values yet implemented).
b76e0809 »
2010-10-31 [common] Allow NQPClassHOW to take and store the name of the class, a…
527 method new_type(:$name = '<anon>', :$repr = 'P6opaque') {
528 my $metaclass := self.new(:name($name));
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
529 nqp::type_object_for($metaclass, 'P6opaque');
530 }
531
4356d783 »
2010-10-23 [common] Add a VERY hacky but working version of method addition and …
532 method add_method($obj, $name, $code_obj) {
2fd812db »
2010-10-31 [dotnet] Make sure at_pos and at_key never return null, but rather so…
533 if %!methods{$name}.defined {
534 die("This class already has a method named " ~ $name);
535 }
4356d783 »
2010-10-23 [common] Add a VERY hacky but working version of method addition and …
536 %!methods{$name} := $code_obj;
537 }
538
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
539 method add_multi_method($obj, $name, $code_obj) {
540 # We can't incorporate these right away as we don't know all
541 # parents yet, maybe, which influences whether we even can
542 # have multis, need to generate a proto or worreva. So just
543 # queue them up in a todo list and we handle it at class
544 # composition time.
545 my %todo;
546 %todo<name> := $name;
547 %todo<code> := $code_obj;
548 @!multi_methods_to_incorporate[+@!multi_methods_to_incorporate] := %todo;
549 $code_obj;
550 }
551
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
552 method add_attribute($obj, $meta_attr) {
553 if $!composed {
554 die("NQPClassHOW does not support adding attributes after being composed.");
555 }
556 my $i := 0;
557 while $i != +@!attributes {
558 if @!attributes[$i].name eq $meta_attr.name {
559 die("Already have an attribute named " ~ $meta_attr.name);
560 }
561 $i := $i + 1;
562 }
563 @!attributes[+@!attributes] := $meta_attr;
564 }
565
566 method add_parent($obj, $parent) {
567 if $!composed {
9269db50 »
2010-11-17 [common] Fix a really silly bug in the multi candidate incorporater t…
568 die("NQPClassHOW does not support adding parents after being composed.");
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
569 }
0b1a12db »
2010-11-17 [common] An extra sanity check for add_parent (discovered missing whi…
570 if $obj =:= $parent {
571 die("Cannot make a class its own parent.");
572 }
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
573 my $i := 0;
574 while $i != +@!parents {
575 if @!parents[$i] =:= $parent {
576 die("Already have " ~ $parent ~ " as a parent class.");
577 }
578 $i := $i + 1;
579 }
580 @!parents[+@!parents] := $parent;
581 }
582
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
583 method compose($obj) {
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
584 # XXX TODO: Compose roles (must come before we make MRO,
585 # and may provide multi candidates.)
b18a4f44 »
2010-11-07 [common] If no parent class is specified, use Mu (for now and in NQP,…
586
587 # If we have no parents and we're not called Mu (XXX that's a
588 # tad fragile, I guess...) then add Mu as our parent.
589 if +@!parents == 0 && $!name ne 'Mu' {
590 self.add_parent($obj, Mu)
591 }
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
592
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
593 # Some things we only do if we weren't already composed once, like
594 # building the MRO.
595 unless $!composed {
596 @!mro := compute_c3_mro($obj);
597 $!composed := 1;
598 }
599
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
600 # Incorporate any new multi candidates (needs MRO built).
601 self.incorporate_multi_candidates($obj);
e2fc32fd »
2010-11-14 [common] Implement type_check and publish a type cache in NQPClassHOW.
602
603 # Publish type cache.
604 self.publish_type_cache($obj);
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
605
39ec4eca »
2010-11-16 [dotnet] add defined method to Mu
606 # Compose attributes.
607 for @!attributes { $_.compose($obj) }
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
608
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
609 $obj
610 }
611
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
612 method incorporate_multi_candidates($obj) {
613 my $num_todo := +@!multi_methods_to_incorporate;
614 my $i := 0;
615 while $i != $num_todo {
616 # Get method name and code.
617 my $name := @!multi_methods_to_incorporate[$i]<name>;
618 my $code := @!multi_methods_to_incorporate[$i]<code>;
619
620 # Do we have anything in the methods table already in
621 # this class?
622 my $dispatcher := %!methods{$name};
623 if $dispatcher.defined {
624 # Yes. Only or dispatcher, though? If only, error. If
625 # dispatcher, simply add new dispatchee.
626 if nqp::is_dispatcher($dispatcher) {
627 nqp::push_dispatchee($dispatcher, $code);
628 }
629 else {
630 die("Cannot have a multi candidate for $name when an only method is also in the class");
631 }
632 }
633 else {
dc36346a »
2010-10-31 [common] Implement searching for a proto in parent classes too, and i…
634 # Go hunting in the MRO for a proto.
635 my $j := 1;
636 my $found := 0;
637 while $j != +@!mro && !$found {
638 my $parent := @!mro[$j];
639 my %meths := $parent.HOW.method_table($parent);
640 my $dispatcher := %meths{$name};
641 if $dispatcher.defined {
642 # Found a possible - make sure it's a dispatcher, not
643 # an only.
644 if nqp::is_dispatcher($dispatcher) {
645 # Clone it and install it in our method table.
646 my @new_dispatchees;
647 @new_dispatchees[0] := $code;
648 %!methods{$name} := nqp::create_dispatch_and_add_candidates($dispatcher, @new_dispatchees);
649 $found := 1;
650 }
651 else {
652 die("Could not find a proto for multi $name (it may exist, but an only is hiding it if so)");
653 }
654 }
9269db50 »
2010-11-17 [common] Fix a really silly bug in the multi candidate incorporater t…
655 $j := $j + 1;
dc36346a »
2010-10-31 [common] Implement searching for a proto in parent classes too, and i…
656 }
657 unless $found {
658 die("Could not find a proto for multi $name, and proto generation is NYI");
659 }
6e2fb412 »
2010-10-31 [dotnet] First cut of multi-methods in NQPClassHOW. At the moment, on…
660 }
661 $i := $i + 1;
662 }
663 }
664
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
665 # XXX TODO: Get enough working to bring over the C3 implementation that
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
666 # we run on 6model on Parrot. For now, we only build it for single
667 # inheritance since it's obvious how to do it.
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
668 sub compute_c3_mro($obj) {
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
669 # MRO starts with this object.
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
670 my @mro;
671 @mro[0] := $obj;
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
672
673 # Now add all parents until we have none.
674 my $cur_obj := $obj;
675 my @parents := $cur_obj.HOW.parents($cur_obj, :local(1));
676 while +@parents {
677 if +@parents == 1 {
9269db50 »
2010-11-17 [common] Fix a really silly bug in the multi candidate incorporater t…
678 @mro.push($cur_obj := @parents[0]);
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
679 @parents := $cur_obj.HOW.parents($cur_obj, :local(1));
680 }
681 else {
682 die("Sorry, multiple inheritance is not yet implemented.");
683 }
684 }
685
686 # Return MRO.
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
687 @mro;
688 }
4356d783 »
2010-10-23 [common] Add a VERY hacky but working version of method addition and …
689
e2fc32fd »
2010-11-14 [common] Implement type_check and publish a type cache in NQPClassHOW.
690 method publish_type_cache($obj) {
691 # XXX TODO: when we have roles, need these here too.
692 nqp::publish_type_check_cache($obj, @!mro)
693 }
694
4356d783 »
2010-10-23 [common] Add a VERY hacky but working version of method addition and …
695 ##
696 ## Introspecty
697 ##
698
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
699 method attributes($obj, :$local!) {
700 @!attributes
701 }
702
4356d783 »
2010-10-23 [common] Add a VERY hacky but working version of method addition and …
703 method method_table($obj) {
704 %!methods
705 }
706
b76e0809 »
2010-10-31 [common] Allow NQPClassHOW to take and store the name of the class, a…
707 method name($obj) {
708 $!name
709 }
710
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
711 method parents($obj, :$local!) {
712 @!parents
713 }
714
ac08da5d »
2010-10-29 [common] Add .defined methods to the various built-in types.
715 method defined() {
716 nqp::repr_defined(self)
717 }
718
4356d783 »
2010-10-23 [common] Add a VERY hacky but working version of method addition and …
719 ##
ea111e5f »
2010-11-07 [common] Implement .isa in NQPClassHOW.
720 ## Czechy
721 ##
722
723 method isa($obj, $checkee) {
724 my $i := 0;
725 my $mro_length := +@!mro;
726 while $i != $mro_length {
727 if @!mro[$i] =:= $checkee {
728 return 1;
729 }
730 $i := $i + 1;
731 }
732 0;
733 }
734
e2fc32fd »
2010-11-14 [common] Implement type_check and publish a type cache in NQPClassHOW.
735 method does($obj, $checkee) {
736 0 # XXX TODO
737 }
738
739 method type_check($obj, $checkee) {
740 self.isa($obj, $checkee) || self.does($obj, $checkee)
741 }
742
ea111e5f »
2010-11-07 [common] Implement .isa in NQPClassHOW.
743 ##
4356d783 »
2010-10-23 [common] Add a VERY hacky but working version of method addition and …
744 ## Dispatchy
745 ##
746
747 method find_method($obj, $name) {
7be7e82e »
2010-12-02 [common] Twiddle with find_method a bit so it doesn't use explicit re…
748 my $found;
749 my %meths;
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
750 my $i := 0;
751 my $mro_length := +@!mro;
7be7e82e »
2010-12-02 [common] Twiddle with find_method a bit so it doesn't use explicit re…
752 while $i < $mro_length {
753 %meths := @!mro[$i].HOW.method_table($obj);
754 $found := %meths{$name};
39ec4eca »
2010-11-16 [dotnet] add defined method to Mu
755 if nqp::repr_defined($found) {
7be7e82e »
2010-12-02 [common] Twiddle with find_method a bit so it doesn't use explicit re…
756 $i := $mro_length;
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
757 }
758 $i := $i + 1;
759 }
7be7e82e »
2010-12-02 [common] Twiddle with find_method a bit so it doesn't use explicit re…
760 unless nqp::repr_defined($found) {
761 die("No method '$name' found in class '" ~ self.name($obj) ~ "'");
762 }
763 $found
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
764 }
765 }
766
767 # A simple attribute meta-object.
2348cc10 »
2010-11-06 [common] Mark the various packages in the setting as lexical ones.
768 my knowhow NQPAttribute {
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
769 has $!name;
39ec4eca »
2010-11-16 [dotnet] add defined method to Mu
770 has $!has_accessor;
771 has $!has_mutator;
772 method new(:$name, :$has_accessor, :$has_mutator) {
773 my $obj := nqp::instance_of(self.WHAT);
774 $obj.BUILD(:name($name), :has_accessor($has_accessor),
775 :has_mutator($has_mutator));
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
776 $obj
777 }
39ec4eca »
2010-11-16 [dotnet] add defined method to Mu
778
779 method BUILD(:$name, :$has_accessor, :$has_mutator) {
780 $!name := $name;
781 $!has_accessor := $has_accessor;
782 $!has_mutator := $has_mutator;
3c4309f3 »
2010-10-31 [common] Much more filling out of NQPClassHOW, plus add a very basic …
783 }
784 method name() {
785 $!name
4356d783 »
2010-10-23 [common] Add a VERY hacky but working version of method addition and …
786 }
39ec4eca »
2010-11-16 [dotnet] add defined method to Mu
787 method has_accessor() {
788 $!has_accessor
789 }
790 method has_mutator() {
791 $!has_mutator
792 }
793 method compose($obj) {
794 my $long_name := $!name;
795 my $short_name := nqp::substr($!name, 2);
796 if $!has_accessor {
797 if $!has_mutator {
798 $obj.HOW.add_method($obj, $short_name, method ($val?) {
8c7d903c »
2010-11-17 [dotnet] remove extraneous 'return'
799 nqp::repr_defined($val)
39ec4eca »
2010-11-16 [dotnet] add defined method to Mu
800 ?? nqp::bind_attr(self, $obj.WHAT, $long_name, $val)
801 !! nqp::get_attr(self, $obj.WHAT, $long_name);
802 });
803 } else {
72c91f00 »
2010-11-17 [dotnet] fix bug jnthn++ found; add tests for the non-"is rw" case
804 $obj.HOW.add_method($obj, $short_name, method () {
39ec4eca »
2010-11-16 [dotnet] add defined method to Mu
805 nqp::get_attr(self, $obj.WHAT, $long_name);
806 });
807 }
808 }
809 }
06d78a2f »
2010-10-22 [common] Start to stub in a very barebones ClassHOW. This is enough t…
810 }
811
5d5adc8d »
2010-11-19 [dotnet] [common] Add an NQPStash type which is a smarter than just a…
812 my knowhow NQPStash {
813 has $!name;
814 has $!namespaces;
815 has $!entries;
816 method new($name?) {
817 my $obj := nqp::instance_of(self);
818 $obj.BUILD($name);
819 $obj
820 }
821 method BUILD($name) {
822 $!name := $name;
823 $!namespaces := NQPHash.new();
824 $!entries := NQPHash.new();
825 }
826 method get_namespace($name) {
827 my $got := $!namespaces.at_key($name);
828 unless $got.defined {
829 $got := NQPStash.new($name);
830 $!namespaces.bind_key($name, $got);
831 }
832 $got
833 }
834 method at_key($name) {
835 $!entries.at_key($name)
836 }
837 method bind_key($name, $value) {
838 $!entries.bind_key($name, $value)
839 }
8c3ca767 »
2010-11-19 [common] Need to have a .defined method if we're gonna call one.
840 method defined() {
841 nqp::repr_defined(self)
842 }
5d5adc8d »
2010-11-19 [dotnet] [common] Add an NQPStash type which is a smarter than just a…
843 }
844
845 ::GLOBAL := NQPStash.new('GLOBAL');
Something went wrong with that request. Please try again.