/
65308.html
executable file
·515 lines (383 loc) · 14 KB
/
65308.html
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>#65308: Monkey-patching from the outside using subtypes should either be disallowed, or it shouldn't affect the method dispatch of the original class in Rakudo</title>
<link rel="shortcut icon" href="/rt3/NoAuth/images//favicon.png" type="image/png" />
<link rel="stylesheet" href="/rt3/NoAuth/css/rt.perl.org/main.css" type="text/css" media="all" />
<link rel="stylesheet" href="/rt3/NoAuth/css/print.css" type="text/css" media="print" />
<script type="text/javascript" src="/rt3/NoAuth/js/util.js"></script>
<script type="text/javascript" src="/rt3/NoAuth/js/titlebox-state.js"></script>
<script type="text/javascript"><!--
onLoadHook("loadTitleBoxStates()");
--></script>
</head>
<body id="comp-Public-Bug-Display">
<div id="logo">
<a href="http://rt.perl.org/rt3/"><img src="/rt3/NoAuth/images//local/pblogo.gif" alt="PerlBug" width="230" height="50"></a>
</div>
<div id="quickbar">
<div id="quick-personal">
<span class="hide"><a href="#skipnav">Skip Menu</a> | </span>
You are currently an anonymous guest.
|
<a href="/rt3/NoAuth/Logout.html?URL=/rt3/index.html?goto=%252FPublic%252FBug%252FDisplay.html%253Fid%253D65308">Login</a>
|
<a href="/rt3/NoAuth/Logout.html">Return to Main</a>
| <a href="/rt3/User/Prefs.html">Preferences</a>
</div>
<div id="topactions">
<span class="topaction">
<form action="/rt3/Public/Search/Simple.html">
<input size="12" name="q" autocomplete="off" accesskey="0" class="field" />
<input type="submit" class="button" value="Search" />
</form>
</span>
</div>
</div>
<div id="nav">
<ul id="system-menu">
<div><div class="wrapper">
</div></div>
</ul>
</div>
<div id="header">
<h1>#65308: Monkey-patching from the outside using subtypes should either be disallowed, or it shouldn't affect the method dispatch of the original class in Rakudo</h1>
<ul id="page-menu">
<div><div><div>
</div></div></div>
</ul>
</div>
<div id="body">
<a name="skipnav" id="skipnav" accesskey="8"></a>
<div class="">
<div class="titlebox " id="">
<div class="titlebox-title">
<span class="widget"><a href="#" onclick="return rollup('TitleBox--_Public_Bug_Display.html------Report information---0');" onfocus="this.blur(); return false;" title="Toggle visibility">X</a></span>
<span class="left">Report information</span>
<span class="right"></span>
</div>
<div class="titlebox-content " id="TitleBox--_Public_Bug_Display.html------Report information---0">
<table width="100%" class="ticket-summary">
<tr>
<td valign="top" width="50%" class="boxcontainer">
<div class="ticket-info-basics">
<div class="titlebox ticket-info-basics" id="">
<div class="titlebox-title">
<span class="widget"><a href="#" onclick="return rollup('TitleBox--_Public_Bug_Display.html--ticket-info-basics----The Basics---0');" onfocus="this.blur(); return false;" title="Toggle visibility">X</a></span>
<span class="left"><a href="/rt3/Ticket/Modify.html?id=65308">The Basics</a></span>
<span class="right"></span>
</div>
<div class="titlebox-content " id="TitleBox--_Public_Bug_Display.html--ticket-info-basics----The Basics---0">
<table>
<tr>
<td class="label id">Id:</td>
<td class="value id">65308</td>
</tr>
<tr>
<td class="label status">Status:</td>
<td class="value status">new</td>
</tr>
<tr>
<td class="label time left">Left:</td>
<td class="value time left">0 min
</td>
</tr>
<tr>
<td class="label priority">Priority:</td>
<td class="value priority">0/0</td>
</tr>
<tr>
<td class="label queue">Queue:</td>
<td class="value queue">perl6
</td>
</tr>
</table>
<hr class="clear" />
</div>
</div>
</div>
<div class="ticket-info-people">
<div class="titlebox ticket-info-people" id="">
<div class="titlebox-title">
<span class="widget"><a href="#" onclick="return rollup('TitleBox--_Public_Bug_Display.html--ticket-info-people----People---0');" onfocus="this.blur(); return false;" title="Toggle visibility">X</a></span>
<span class="left"><a href="/rt3/Ticket/ModifyPeople.html?id=65308">People</a></span>
<span class="right"></span>
</div>
<div class="titlebox-content " id="TitleBox--_Public_Bug_Display.html--ticket-info-people----People---0">
<table>
<tr>
<td class="label">Owner:</td>
<td class="value">
Nobody
</td>
</tr>
<tr>
<td class="labeltop">Requestors:</td>
<td class="value">
masak
<cmasak [at] gmail.com>
<br />
</td>
</tr>
<tr>
<td class="labeltop">Cc:</td>
<td class="value">
</td>
</tr>
<tr>
<td class="labeltop">AdminCc:</td>
<td class="value">
</td>
</tr>
</table>
<hr class="clear" />
</div>
</div>
</div>
</td>
<td valign="top" width="50%" class="boxcontainer">
<div class="ticket-info-cfs">
<div class="titlebox ticket-info-cfs" id="">
<div class="titlebox-title">
<span class="widget"><a href="#" onclick="return rollup('TitleBox--_Public_Bug_Display.html--ticket-info-cfs----Bug Information---0');" onfocus="this.blur(); return false;" title="Toggle visibility">X</a></span>
<span class="left"><a href="/rt3/Ticket/Modify.html?id=65308">Bug Information</a></span>
<span class="right"></span>
</div>
<div class="titlebox-content " id="TitleBox--_Public_Bug_Display.html--ticket-info-cfs----Bug Information---0">
<table>
<tr id="CF-18-ShowRow">
<td class="label">Severity:</td>
<td class="value">
<i>(no value)</i>
</td>
</tr>
<tr id="CF-19-ShowRow">
<td class="label">Tag:</td>
<td class="value">
<i>(no value)</i>
</td>
</tr>
<tr id="CF-20-ShowRow">
<td class="label">Platform:</td>
<td class="value">
<i>(no value)</i>
</td>
</tr>
<tr id="CF-21-ShowRow">
<td class="label">Patch Status:</td>
<td class="value">
<i>(no value)</i>
</td>
</tr>
</table>
<hr class="clear" />
</div>
</div>
</div>
<div class="ticket-info-links">
<div class="titlebox ticket-info-links" id="">
<div class="titlebox-title">
<span class="widget"><a href="#" onclick="return rollup('TitleBox--_Public_Bug_Display.html--ticket-info-links----Links---0');" onfocus="this.blur(); return false;" title="Toggle visibility">X</a></span>
<span class="left"><a href="/rt3/Ticket/ModifyLinks.html?id=65308">Links</a></span>
<span class="right"></span>
</div>
<div class="titlebox-content " id="TitleBox--_Public_Bug_Display.html--ticket-info-links----Links---0">
<table>
<tr>
<td class="labeltop">Depends on:</td>
<td class="value">
<ul>
</ul>
</td>
</tr>
<tr>
<td class="labeltop">Depended on by:</td>
<td class="value">
<ul>
</ul>
</td>
</tr>
<tr>
<td class="labeltop">Parents:</td>
<td class="value">
<ul>
</ul>
</td>
</tr>
<tr>
<td class="labeltop">Children:</td>
<td class="value"></td>
</tr>
<tr>
<td class="labeltop">Refers to:</td>
<td class="value">
<ul>
</ul>
</td>
</tr>
<tr>
<td class="labeltop">Referred to by:</td>
<td class="value">
<ul>
</ul>
</td>
</tr>
</table>
<hr class="clear" />
</div>
</div>
</div>
</td>
</tr>
</table>
<hr class="clear" />
</div>
</div>
</div>
<br />
<div class="titlebox " id="">
<div class="titlebox-title">
<span class="widget"><a href="#" onclick="return rollup('TitleBox--_Public_Bug_Display.html------History---0');" onfocus="this.blur(); return false;" title="Toggle visibility">X</a></span>
<span class="left">History</span>
<span class="right"><span style="color: black">Display mode:</span> <span class="selected">Brief headers</span> — <a href="/rt3/Ticket/Display.html?ShowHeaders=1;id=65308">Full headers</a></span>
</div>
<div class="titlebox-content " id="TitleBox--_Public_Bug_Display.html------History---0">
<div id="ticket-history">
<div class="ticket-transaction message odd">
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td rowspan="2" valign="top" class="type">
<a name="txn-559820" href="/rt3/Ticket/Display.html?id=65308#txn-559820">#</a>
</td>
<td class="date">Fri May 01 12:07:45 2009</td>
<td class="description">
masak - Ticket created
</td>
<td class="time-taken"></td>
<td class="actions"> </td>
</tr>
<tr>
<td colspan="4" class="content">
<table>
<tr>
<td align="right" class="message-header-key">Subject:</td>
<td class="message-header-value">Monkey-patching from the outside using subtypes should either be disallowed, or it shouldn't affect the method dispatch of the original class in Rakudo</td>
</tr>
<tr>
<td align="right" class="message-header-key">Date:</td>
<td class="message-header-value">Fri, 1 May 2009 21:07:03 +0200</td>
</tr>
<tr>
<td align="right" class="message-header-key">To:</td>
<td class="message-header-value">rakudobug <!-- x --> at perl.org</td>
</tr>
<tr>
<td align="right" class="message-header-key">From:</td>
<td class="message-header-value">Carl Mäsak <cmasak <!-- x --> at gmail.com></td>
</tr>
</table>
<div class="downloadattachment">
<a href="/rt3/Ticket/Attachment/559820/266350/">Download (untitled)</a>
<span class="downloadcontenttype">
[text/plain 2.7k]
</span>
</div>
<div class="messagebody">
<div class="message-stanza-depth-0">
<masak> rakudo: subset FooStr of Str where /^foo/; multi method<br />
trim(FooStr $self:) { return "OH HAI" }; say "foo".trim<br />
<p6eval> rakudo b83a0b: OUTPUT«OH HAI»<br />
<masak> that's just... so cool.<br />
<masak> I can haz dispatch on subtyped invocant! \o/<br />
<masak> rakudo: subset FooStr of Str where /^foo/; multi method<br />
trim(FooStr $self:) { return "OH HAI" }; say "bar".trim<br />
<p6eval> rakudo b83a0b: OUTPUT«No applicable candidates found to<br />
dispatch to for 'trim'current instr.: 'parrot;P6metaclass;dispatch'<br />
pc 243371 (src/gen_actions.pir:0)»<br />
<masak> jnthn: how come that doesn't work, though?<br />
<masak> it seems an applicable candidate to me...<br />
<jnthn> You're deifning methods outside of a class...<br />
<masak> jnthn: anyway... why doesn't the "bar" version dispatch to Str.trim?<br />
<masak> more importantly, is it something I should tell RT about?<br />
<jnthn> masak: I'm not entirely sure how/why the first one works.<br />
<masak> :)<br />
<masak> it felt amazing that it did, to be sure.<br />
<masak> I mean, who needs monkeypatching when you can dispatch on<br />
subtyped invocants?<br />
<jnthn> Well, you're essentially monkey-patching without the monkey.<br />
<masak> *lol*<br />
<jnthn> masak: On subset decl issue, already there is 64098[BUG] MMD<br />
on subset types fails for short name<br />
<masak> oh, ok.<br />
<masak> not the same issue, I'd say.<br />
<masak> problem is, I don't really know what the issue should be with<br />
the monkey-sans-monkey-patching.<br />
<masak> is it that the original method is hidden?<br />
<masak> or that dispatching on subset types of the invocant shouldn't<br />
be allowed at all?<br />
<jnthn> I don't know that writing a method outside a class like that<br />
is allowed (other than having heard various references to some Main<br />
class...)<br />
<jnthn> (and either way, Main is not Any)<br />
<jnthn> My guess is that you're ending up augmenting the exported trim<br />
<masak> is there a place in the spec that mentions declaring methods<br />
outside of their class scope?<br />
<jnthn> And we didn't clone the multi that the class exported, and<br />
thus why it looked like it affectd the class.<br />
<jnthn> Anonlymous ones yes, named ones I can't recall one.<br />
<jnthn> But there are I think references to a class Main.<br />
<masak> jnthn: should I report it as a bug saying that the Str.trim<br />
should still work?<br />
<jnthn> There's *something* wrong that your example reveals.<br />
<jnthn> I'm not completely sure what it is yet.<br />
<masak> me neither.<br />
<jnthn> I'm pretty sure that you should not have been able to affect<br />
the Str class though.<br />
<jnthn> We might be missing some cloning in the exporter.<br />
* masak hesitantly submits a rakudobug<br />
<jnthn> Well, I mean that a method with a Str invocant declared out of<br />
class Str or not monkey-patched into it should not affect instances of<br />
Str.<br />
<jnthn> I think that might be the real wtf here.<br />
<masak> jnthn: aye.<br />
<masak> feels like monkey-patching from the outside.<br />
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
<hr class="clear" />
</div>
</div>
</div>
<hr size=0>
<div>
For issues related to this RT instance (aka "perlbug"), please contact <tt>perlbug-admin at perl.org</tt>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-50555-18");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<div id="footer">
<p id="time">
<span>Time to display: 0.283077</span>
</p>
<p id="bpscredits">
<span>
»|« RT 3.6.HEAD Copyright 1996-2006 <a href="http://www.bestpractical.com?rt=3.6.HEAD">Best Practical Solutions, LLC</a>.
</span>
</p>
</div>
</body>
</html>