Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge conflict resolution on IO.pm: take new encoding change

  • Loading branch information...
commit a2da68c60dc6e51d37c1ebaf8050a6b774bb483e 2 parents 4eb1b6e + 16db643
ajscogo authored July 02, 2012
12  INSTALL.txt
@@ -8,10 +8,13 @@
8 8
     library installed (<http://site.icu-project.org/>). Rakudo can run
9 9
     without ICU, but some Unicode-related features do not work properly.
10 10
 
  11
+    To get readline support (command history and editing), you'll also
  12
+    need the "libreadline-dev" library.
  13
+
11 14
     As an example, on Debian GNU/Linux or Ubuntu Linux, the necessary
12 15
     components for building Rakudo can be installed via the command
13 16
 
14  
-        aptitude install build-essential libicu-dev git-core
  17
+        aptitude install make gcc libicu-dev libreadline-dev git-core
15 18
 
16 19
     (Perl is installed by default already). To enable parallel testing you
17 20
     also need the CPAN module Test::Harness in version 3.16 or newer; you
@@ -19,8 +22,9 @@
19 22
     variable.
20 23
 
21 24
   Building and invoking Rakudo
22  
-    Because Rakudo is under rapid development, we generally recommend
23  
-    downloading Rakudo directly from github and building from there:
  25
+    If you're wanting the bleeding-edge version of the Rakudo Perl 6
  26
+    compiler, we recommend downloading Rakudo directly from Github 
  27
+    and building it from there.
24 28
 
25 29
         $ git clone git://github.com/rakudo/rakudo.git
26 30
 
@@ -78,7 +82,7 @@
78 82
     satify a minimum specified by the Rakudo being built -- Configure.pl
79 83
     and "make" will verify this for you.  Released versions of Rakudo
80 84
     always build against the latest release of Parrot; checkouts of 
81  
-    the HEAD revision from github often require a version of Parrot 
  85
+    Rakudo's HEAD revision from Github often require a version of Parrot 
82 86
     that is newer than the most recent Parrot monthly release.
83 87
 
84 88
     Once built, Rakudo's "make install" target will install Rakudo and its
3  README
... ...
@@ -1,7 +1,7 @@
1 1
 Rakudo Perl 6
2 2
     This is Rakudo Perl, a Perl 6 compiler for the Parrot virtual machine.
3 3
 
4  
-    Rakudo Perl is Copyright (C) 2008-2011, The Perl Foundation. Rakudo Perl
  4
+    Rakudo Perl is Copyright (C) 2008-2012, The Perl Foundation. Rakudo Perl
5 5
     is distributed under the terms of the Artistic License 2.0. For more
6 6
     details, see the full text of the license in the file LICENSE.
7 7
 
@@ -18,6 +18,7 @@ Rakudo Perl 6
18 18
     See the INSTALL.txt file for detailed prerequisites and build and
19 19
     installation instructions. The short version is
20 20
 
  21
+    $ # recommended: install libicu-dev and libreadline-dev packages
21 22
     $ perl Configure.pl --gen-parrot --gen-nqp
22 23
     $ make
23 24
     $ make spectest # optional
6  docs/ChangeLog
... ...
@@ -1,5 +1,11 @@
1 1
 New in 2012.07
2 2
 + Deprecated SAFE.setting in favor of RESTRICTED.setting
  3
++ Ranges can now interpolate in argument lists
  4
++ The built-in meta-objects (such as Metamodel::ClassHOW) now inherit from Any
  5
++ &open now supports :enc/:encoding
  6
++ Exception.fail
  7
++ Changed &dir to return IO::File and IO::Dir objects, not strings
  8
++ anonymous subset types with  subset :: where ...;
3 9
 
4 10
 New in 2012.06
5 11
 + Rakudo is now compiled with the same regex engine as user-space regexes use
132  docs/release_guide.pod
Source Rendered
@@ -93,13 +93,13 @@ release name, etc.
93 93
 
94 94
 =item *
95 95
 
96  
-Verify that the Parrot trunk head is able to build Rakudo
  96
+Verify that the Parrot master branch is able to build Rakudo
97 97
 and run the spectest suite. Also check the smolder reports
98 98
 at L<http://smolder.parrot.org/app/projects/smoke_reports/5>.
99 99
 
100 100
 =item *
101 101
 
102  
-If Parrot's trunk exhibits any problems building or running
  102
+If Parrot's master branch exhibits any problems building or running
103 103
 Rakudo (that require changes to Parrot to fix), immediately
104 104
 report them to the Parrot development team so they can be
105 105
 fixed prior to Parrot's release.
@@ -113,25 +113,33 @@ that has a large impact on users is worth addressing either
113 113
 as a fix or as prominent documentation (the README and/or
114 114
 the release announcement).
115 115
 
116  
-=back
  116
+=item *
117 117
 
118  
-=item 2.
  118
+Create a draft release announcement in docs/announce/YYYY.MM .
  119
+You can often use the previous release's file as a starting point,
  120
+updating the release number, version information, name, etc. as
  121
+appropriate.
119 122
 
120  
-Once Parrot issues its monthly release, tag NQP for release
121  
-according to the year and month of the release:
  123
+  $ git add docs/announce/YYYY.MM
  124
+  $ git commit docs
122 125
 
123  
-    $ git clone https://github.com/perl6/nqp.git
124  
-    $ cd nqp
  126
+=item *
125 127
 
126  
-Follow the steps in NQP's F<docs/release_guide.pod>.
  128
+If it's a month relatively early in the calendar year, 
  129
+double-check that the copyright date in the README file includes 
  130
+the current year.  (It's not necessary to update copyright dates 
  131
+in other files, unless you know that a given file has been modified
  132
+in a year not reflected by the file's copyright notice.)
127 133
 
128  
-=item 3.
  134
+=back
  135
+
  136
+=item 2.
129 137
 
130 138
 The short period following the Parrot release until the
131 139
 Rakudo release is generally intended for fixing bugs,
132 140
 updating documentation, and so on.
133 141
 
134  
-=item 4.
  142
+=item 3.
135 143
 
136 144
 Update Rakudo's leap-second tables:
137 145
 
@@ -147,7 +155,7 @@ will be unchanged.
147 155
 
148 156
 B<Note>: this program requires the perl module L<Time::y2038> be installed.
149 157
 
150  
-=item 5.
  158
+=item 4.
151 159
 
152 160
 As the actual release date nears, review the git log history
153 161
 to see if any additional items need to be added to the ChangeLog.
@@ -155,14 +163,14 @@ This can be conveniently done with  "git log --since=yyyy-mm-dd --reverse".
155 163
 
156 164
   $ git commit docs/ChangeLog
157 165
 
158  
-=item 6.
  166
+=item 5.
159 167
 
160  
-When it's time to cut the release, create a new release announcement
161  
-in docs/announce/YYYY.MM.  It's often a good idea to use the
162  
-previous month's file as a starting point for this.  Highlight areas
163  
-in which the new release is significant.  If possible, also give
164  
-some small details about the choice of release name.  (If the
165  
-details are a bit lengthy, this can often best be done as a separate
  168
+When it's time to cut the release, finalize the new release 
  169
+announcement in docs/announce/YYYY.MM.  (If one hasn't already
  170
+been created, see step 1 above.) Highlight areas in which the 
  171
+new release is significant.  If possible, also give some small 
  172
+details about the choice of release name.  (If the details 
  173
+are a bit lengthy, this can often best be done as a separate
166 174
 section at the bottom of the announcement.)
167 175
 
168 176
 Include a list of contributors since the last release in the announcement.
@@ -185,7 +193,33 @@ you find any steps that are missing.
185 193
 
186 194
   $ git commit docs/release_guide.pod
187 195
 
188  
-=item 8.
  196
+=item 8. 
  197
+
  198
+Create an NQP release with the same C<YYYY.MM> version number
  199
+as Rakudo. Follow NQP's C<docs/release_guide.pod> file to do that.
  200
+
  201
+=item 9.
  202
+
  203
+Go back to the Rakudo repository, and update the NQP dependency:
  204
+
  205
+  $ echo YYYY.MM > tools/build/NQP_REVISION
  206
+  $ git commit -m '[release] bump NQP revision' tools/build/NQP_REVISION
  207
+
  208
+=item 10.
  209
+
  210
+Enter the new version into the F<VERSION> file, and commit the changes:
  211
+
  212
+  $ echo YYYY.MM > VERSION
  213
+  $ git commit -m '[release] bump VERSION' VERSION
  214
+
  215
+=item 11.
  216
+
  217
+Make sure any locally modified files have been pushed back to github.
  218
+
  219
+  $ git status
  220
+  $ git push
  221
+
  222
+=item 12.
189 223
 
190 224
 Make sure everything compiles and runs from a known clean state:
191 225
 
@@ -209,51 +243,7 @@ Often this means fixing a bug, fudging a test, or (temporarily?)
209 243
 commenting out a test file in t/spectest.data .  Use your best
210 244
 judgment or ask others if uncertain what to do here.
211 245
 
212  
-=item 9. 
213  
-
214  
-=over 4
215  
-
216  
-=item *
217  
-
218  
-B<Note>: these steps overlap with the steps in NQP's release guide.
219  
-
220  
-Go to the NQP repository, tag it and push the tags
221  
-
222  
-  $ git tag -a -m"tag release YYYY.MM" YYYY.MM    # e.g., 2010.02
223  
-
224  
-Check the NQP revision
225  
-
226  
-  $ git describe  # should come out as YYYY.MM
227  
-                  # if not, contact your local git vendor or #perl6
228  
-
229  
-If you got the same version back as you entered, proceed with
230  
-
231  
-  $ git push --tags
232  
-
233  
-=item *
234  
-
235  
-Go back to the Rakudo repository, and update the NQP dependency:
236  
-
237  
-  $ echo YYYY.MM > tools/build/NQP_REVISION
238  
-  $ git commit -m '[release] bump NQP revision' tools/build/NQP_REVISION
239  
-
240  
-=item *
241  
-
242  
-Enter the new version into the F<VERSION> file, and commit the changes:
243  
-
244  
-  $ echo YYYY.MM > VERSION
245  
-  $ git commit -m '[release] bump VERSION' VERSION
246  
-
247  
-=back
248  
-
249  
-=item 10.
250  
-
251  
-Make sure any locally modified files have been pushed back to github.
252  
-
253  
-  $ git status
254  
-  $ git push
255  
-
256  
-=item 11.
  246
+=item 13.
257 247
 
258 248
 Create a tarball by entering C<make release VERSION=YYYY.MM>,
259 249
 where YYYY.MM is the month for which the release is being made.
@@ -262,13 +252,13 @@ This will create a tarball file named C<rakudo-YYYY.MM.tar.gz>.
262 252
 B<Caution>: this step removes any untracked files in F<t/spec>.
263 253
 So please make a backup if you have any important data in there.
264 254
 
265  
-=item 12.
  255
+=item 14.
266 256
 
267 257
 Unpack the tar file into another area, and test that it
268 258
 builds and runs properly using the same process in step 8.
269 259
 If there are any problems, fix them and go back to step 8.
270 260
 
271  
-=item 13.
  261
+=item 15.
272 262
 
273 263
 Tag the release by its release month ("YYYY.MM") and its code name.
274 264
 
@@ -276,12 +266,12 @@ Tag the release by its release month ("YYYY.MM") and its code name.
276 266
   $ git tag -a -m"tag release #nn" CODENAME   # e.g., "Bratislava"
277 267
   $ git push --tags
278 268
 
279  
-=item 14.
  269
+=item 16.
280 270
 
281 271
 Upload the release tarball to github's download area at
282 272
 L<http://github.com/rakudo/rakudo/downloads>.
283 273
 
284  
-=item 15.
  274
+=item 17.
285 275
 
286 276
 To avoid public confusion with Rakudo Star releases, we now publish 
287 277
 compiler release announcements ONLY to perl6-compiler@perl.org.  
@@ -289,11 +279,11 @@ compiler release announcements ONLY to perl6-compiler@perl.org.
289 279
 once they are known, or we may begin publishing a single
290 280
 announcement for both.)
291 281
 
292  
-=item 16.
  282
+=item 18.
293 283
 
294 284
 Update the Wikipedia entry at L<http://en.wikipedia.org/wiki/Rakudo>.
295 285
 
296  
-=item 17.
  286
+=item 19.
297 287
 
298 288
 You're done!  Celebrate with the appropriate amount of fun.
299 289
 
53  docs/review-notes.txt
... ...
@@ -1,53 +0,0 @@
1  
-This file contains various notes and observations Pm makes as
2  
-he reviews code.  Many of these can become RT tickets -- this is
3  
-just a lighter-weight mechanism for keeping track of things to be
4  
-reviewed/done.
5  
-
6  
-Active notes
7  
-
8  
-Pm-1:  In src/core/Array.pm, the exists() method has a line like:
9  
-
10  
-        [?&] map { self[$^a] !~~ Proxy }, @indices;
11  
-
12  
-There doesn't seem to be a strong reason for using C<map> and [?&]
13  
-here... more efficient would seem to be to use a slice directly, 
14  
-as in:
15  
-
16  
-        none(self[@indices]) ~~ Proxy
17  
-
18  
-Also, I'm fairly certain the test for Proxy won't stand, because
19  
-we'd like .exists() to also work on Lists.  In fact, any sort of
20  
-type-based test is likely wrong -- we'll probably have to resort
21  
-to some PIR-based testing here, since only PIR will really know if
22  
-an element is present in the List/Array.
23  
-
24  
-
25  
-Pm-2:  The subroutines in src/core/metaops.pm (e.g,. &reducewith)
26  
-all end up being visible in the core setting.  Should they be?
27  
-(I'm thinking they're actually internal helper subs, and as such 
28  
-should not be part of the core setting, much less global subs
29  
-as they are now.)
30  
-
31  
-
32  
-Pm-3:  Is there any strong reason why Junction.new has C<:any>,
33  
-C<:all>, C<:one>, etc. flags instead of just using  C<< :type<any> >>?
34  
-
35  
-
36  
-Pm-4:  Why does Rakudo have  "EnumMap is Cool" ?  Why is it that
37  
-all Iterables are considered Cool?
38  
-
39  
-
40  
-Pm-5:  Can someone point to the specification or explain the logic
41  
-behind Parcel.ACCEPTS?
42  
-
43  
-
44  
-------
45  
-
46  
-Resolved notes:
47  
-
48  
-None yet.
49  
-
50  
-
51  
-
52  
-
53  
-
37  src/Perl6/Actions.pm
@@ -1411,7 +1411,7 @@ class Perl6::Actions is HLL::Actions {
1411 1411
                     }
1412 1412
                 }
1413 1413
                 elsif $<initializer>[0]<sym> eq '=' {
1414  
-                    $past := assign_op($past, $<initializer>[0].ast);
  1414
+                    $past := assign_op($/, $past, $<initializer>[0].ast);
1415 1415
                 }
1416 1416
                 elsif $<initializer>[0]<sym> eq '.=' {
1417 1417
                     $past := make_dot_equals($past, $<initializer>[0].ast);
@@ -1456,7 +1456,7 @@ class Perl6::Actions is HLL::Actions {
1456 1456
                 if $<initializer>[0]<sym> eq '=' {
1457 1457
                     $/.CURSOR.panic("Cannot assign to a list of 'has' scoped declarations")
1458 1458
                         if $*SCOPE eq 'has';
1459  
-                    $list := assign_op($list, $<initializer>[0].ast);
  1459
+                    $list := assign_op($/, $list, $<initializer>[0].ast);
1460 1460
                 }
1461 1461
                 elsif $<initializer>[0]<sym> eq '.=' {
1462 1462
                     $/.CURSOR.panic("Cannot use .= initializer with a list of declarations");
@@ -2453,7 +2453,7 @@ class Perl6::Actions is HLL::Actions {
2453 2453
         }
2454 2454
 
2455 2455
         # Install it as needed.
2456  
-        if $<longname> {
  2456
+        if $<longname> && $longname.type_name_parts('subset name', :decl(1)) {
2457 2457
             $*W.install_package($/, $longname.type_name_parts('subset name', :decl(1)),
2458 2458
                 ($*SCOPE || 'our'), 'subset', $*PACKAGE, $*W.cur_lexpad(), $subset);
2459 2459
         }
@@ -3589,7 +3589,7 @@ class Perl6::Actions is HLL::Actions {
3589 3589
         '<<==', -> $/, $sym { make_feed($/) },
3590 3590
         '~~',   -> $/, $sym { make_smartmatch($/, 0) },
3591 3591
         '!~~',  -> $/, $sym { make_smartmatch($/, 1) },
3592  
-        '=',    -> $/, $sym { assign_op($/[0].ast, $/[1].ast) },
  3592
+        '=',    -> $/, $sym { assign_op($/, $/[0].ast, $/[1].ast) },
3593 3593
         ':=',   -> $/, $sym { bind_op($/, $/[0].ast, $/[1].ast, 0) },
3594 3594
         '::=',  -> $/, $sym { bind_op($/, $/[0].ast, $/[1].ast, 1) },
3595 3595
         'ff',   -> $/, $sym { flipflop($/[0].ast, $/[1].ast, 0, 0, 0) },
@@ -3867,7 +3867,7 @@ class Perl6::Actions is HLL::Actions {
3867 3867
         }
3868 3868
     }
3869 3869
 
3870  
-    sub assign_op($lhs_ast, $rhs_ast) {
  3870
+    sub assign_op($/, $lhs_ast, $rhs_ast) {
3871 3871
         my $past;
3872 3872
         my $var_sigil;
3873 3873
         if $lhs_ast.isa(PAST::Var) {
@@ -3889,7 +3889,8 @@ class Perl6::Actions is HLL::Actions {
3889 3889
                 $lhs_ast, $rhs_ast);
3890 3890
         }
3891 3891
         else {
3892  
-            $past := PAST::Op.new(:pirop('perl6_container_store__0PP'),
  3892
+            $past := PAST::Op.new(:node($/), :pirop('perl6_container_store__0PP'),
  3893
+
3893 3894
                 $lhs_ast, $rhs_ast);
3894 3895
         }
3895 3896
         return $past;
@@ -4073,6 +4074,15 @@ class Perl6::Actions is HLL::Actions {
4073 4074
         }
4074 4075
     }
4075 4076
 
  4077
+    sub baseop_reduce($/) {
  4078
+        my $reduce := 'LEFT';
  4079
+        if    $<assoc> eq 'right'  
  4080
+           || $<assoc> eq 'list'   { $reduce := nqp::uc($<assoc>); }
  4081
+        elsif $<prec> eq 'm='      { $reduce := 'CHAIN'; }
  4082
+        elsif $<pasttype> eq 'xor' { $reduce := 'XOR'; }
  4083
+        '&METAOP_REDUCE_' ~ $reduce;
  4084
+    }
  4085
+
4076 4086
     method infixish($/) {
4077 4087
         if $<infix_postfix_meta_operator> {
4078 4088
             my $base     := $<infix>;
@@ -4107,9 +4117,12 @@ class Perl6::Actions is HLL::Actions {
4107 4117
             elsif $metasym eq 'X' { $helper := '&METAOP_CROSS'; }
4108 4118
             elsif $metasym eq 'Z' { $helper := '&METAOP_ZIP'; }
4109 4119
 
4110  
-            make PAST::Op.new( :node($/),
4111  
-                     PAST::Op.new( :pasttype<call>,
4112  
-                         :name($helper), $basepast ));
  4120
+            my $metapast := PAST::Op.new( :pasttype<call>, :name($helper),
  4121
+                                $basepast);
  4122
+            $metapast.push(PAST::Var.new(:name(baseop_reduce($base<OPER><O>)),
  4123
+                                         :scope<lexical_6model>))
  4124
+                if $metasym eq 'X' || $metasym eq 'Z';
  4125
+            make PAST::Op.new( :node($/), $metapast );
4113 4126
         }
4114 4127
 
4115 4128
         if $<infixish> {
@@ -4123,11 +4136,7 @@ class Perl6::Actions is HLL::Actions {
4123 4136
                           ?? $base.ast[0]
4124 4137
                           !! PAST::Var.new(:name("&infix:<" ~ $base<OPER><sym> ~ ">"),
4125 4138
                                            :scope<lexical_6model>);
4126  
-        my $metaop   := '&METAOP_REDUCE';
4127  
-        if $base<OPER><O><assoc> eq 'right'     { $metaop := '&METAOP_REDUCE_RIGHT' }
4128  
-        elsif $base<OPER><O><assoc> eq 'list'   { $metaop := '&METAOP_REDUCE_LIST'  }
4129  
-        elsif $base<OPER><O><prec> eq 'm='      { $metaop := '&METAOP_REDUCE_CHAIN' }
4130  
-        elsif $base<OPER><O><pasttype> eq 'xor' { $metaop := '&METAOP_REDUCE_XOR' }
  4139
+        my $metaop   := baseop_reduce($base<OPER><O>);
4131 4140
         my $metapast := PAST::Op.new( :pasttype<call>, :name($metaop), $basepast);
4132 4141
         if $<triangle> {
4133 4142
             my $tri := $*W.add_constant('Int', 'int', 1);
2  src/Perl6/Metamodel/MultiMethodContainer.pm
@@ -85,7 +85,7 @@ role Perl6::Metamodel::MultiMethodContainer {
85 85
                 unless $found {
86 86
                     # No proto found, so we'll generate one here.
87 87
                     unless $autogen_proto {
88  
-                        nqp::die("Cannot auto-generate a proto method in the setting");
  88
+                        nqp::die("Cannot auto-generate a proto method for '$name' in the setting");
89 89
                     }
90 90
                     my $proto := $autogen_proto.instantiate_generic(
91 91
                         hash( T => $obj ));
6  src/core/Any.pm
@@ -246,6 +246,12 @@ my class Any {
246 246
     }
247 247
 
248 248
     method reduce(&with) { self.list.reduce(&with) }
  249
+
  250
+    method FLATTENABLE_LIST() { 
  251
+        my $list := self.list;
  252
+        nqp::findmethod($list, 'FLATTENABLE_LIST')($list);
  253
+    }
  254
+    method FLATTENABLE_HASH() { nqp::hash() }
249 255
 }
250 256
 Metamodel::ClassHOW.exclude_parent(Any);
251 257
 
17  src/core/Backtrace.pm
@@ -8,7 +8,7 @@ my class Backtrace is List {
8 8
         has Mu  $.code;
9 9
         has Str $.subname;
10 10
 
11  
-        method subtype {
  11
+        method subtype(Frame:D:) {
12 12
             my $s = $!code.^name.lc.split('+', 2)[0];
13 13
             $s eq 'mu' ?? '' !! $s;
14 14
         }
@@ -19,9 +19,9 @@ my class Backtrace is List {
19 19
             "  in {$s}$.subname at {$.file}:$.line\n"
20 20
         }
21 21
 
22  
-        method is-hidden  { $!code.?is_hidden_from_backtrace }
23  
-        method is-routine { $!code ~~ Routine }
24  
-        method is-setting { $!file eq 'src/gen/CORE.setting' }
  22
+        method is-hidden(Frame:D:)  { $!code.?is_hidden_from_backtrace }
  23
+        method is-routine(Frame:D:) { $!code ~~ Routine }
  24
+        method is-setting(Frame:D:) { $!file eq 'src/gen/CORE.setting' }
25 25
     }
26 26
     proto method new(|$) {*}
27 27
 
@@ -61,7 +61,7 @@ my class Backtrace is List {
61 61
         $new;
62 62
     }
63 63
 
64  
-    method next-interesting-index(Int $idx is copy = 0) {
  64
+    method next-interesting-index(Backtrace:D: Int $idx is copy = 0) {
65 65
         ++$idx;
66 66
         # NOTE: the < $.end looks like an off-by-one error
67 67
         # but it turns out that a simple   perl6 -e 'die "foo"'
@@ -74,7 +74,7 @@ my class Backtrace is List {
74 74
         Int;
75 75
     }
76 76
 
77  
-    method outer-caller-idx(Int $startidx is copy) {
  77
+    method outer-caller-idx(Backtrace:D: Int $startidx is copy) {
78 78
         my %print;
79 79
         my $start   = self.at_pos($startidx).code;
80 80
         return $startidx.list unless $start;
@@ -95,7 +95,7 @@ my class Backtrace is List {
95 95
         return @outers;
96 96
     }
97 97
 
98  
-    method nice(:$oneline) {
  98
+    method nice(Backtrace:D: :$oneline) {
99 99
         try {
100 100
             my @frames;
101 101
             my Int $i = self.next-interesting-index(-1);
@@ -104,6 +104,7 @@ my class Backtrace is List {
104 104
                     while $oneline && $i.defined
105 105
                           && self.at_pos($i).is-setting;
106 106
 
  107
+                last unless $i.defined;
107 108
                 my $prev = self.at_pos($i);
108 109
                 if $prev.is-routine {
109 110
                     @frames.push: $prev;
@@ -121,7 +122,7 @@ my class Backtrace is List {
121 122
             return @frames.join;
122 123
             CATCH {
123 124
                 default {
124  
-                    return "<Internal error while creating backtrace: $!.message().\n"
  125
+                    return "<Internal error while creating backtrace: $_.message() $_.backtrace.full().\n"
125 126
                         ~ "Please report this as a bug (mail to rakudobug@perl.org)\n", 
126 127
                         ~ "and re-run with the --ll-exception command line option\n"
127 128
                         ~ "to get more information about your error>";
15  src/core/Bool.pm
@@ -24,6 +24,10 @@ my class Bool {
24 24
     }
25 25
 }
26 26
 
  27
+multi prefix:<++>(Bool:U \$a is rw) { $a = True; }
  28
+multi prefix:<-->(Bool:U \$a is rw) { $a = False; }
  29
+multi postfix:<++>(Bool:U \$a is rw) { $a = True; False; }
  30
+multi postfix:<-->(Bool:U \$a is rw) { $a = False; }
27 31
 
28 32
 proto prefix:<?>($) { * }
29 33
 multi prefix:<?>(Bool:D \$a) { $a }
@@ -69,6 +73,16 @@ multi infix:<||>(Mu \$a, Mu \$b)      { $a || $b }
69 73
 proto infix:<^^>(|$)                  { * }
70 74
 multi infix:<^^>(Mu $x = Bool::False) { $x }
71 75
 multi infix:<^^>(Mu \$a, Mu \$b)      { $a ^^ $b }
  76
+multi infix:<^^>(*@a) {
  77
+    my $a = shift @a;
  78
+    while @a {
  79
+        my $b := shift @a;
  80
+        next unless $b;
  81
+        return Nil if $a;
  82
+        $a := $b;
  83
+    }
  84
+    $a;
  85
+}
72 86
 
73 87
 proto infix:<//>(|$)                  { * }
74 88
 multi infix:<//>(Mu $x = Any)         { $x }
@@ -85,6 +99,7 @@ multi infix:<or>(Mu \$a, Mu \$b)      { $a || $b }
85 99
 proto infix:<xor>(|$)                  { * }
86 100
 multi infix:<xor>(Mu $x = Bool::False) { $x }
87 101
 multi infix:<xor>(Mu \$a, Mu \$b)      { $a ^^ $b }
  102
+multi infix:<xor>(*@a)                 { &infix:<^^>(@a); }
88 103
 
89 104
 proto infix:<orelse>(|$)              { * }
90 105
 multi infix:<orelse>(Mu $x = Any)     { $x }
2  src/core/Cool.pm
@@ -56,7 +56,7 @@ my class Cool {
56 56
 
57 57
     ## string methods
58 58
 
59  
-    method bytes() {
  59
+    method bytes() is DEPRECATED {
60 60
         nqp::p6box_i(pir::bytelength__IS(nqp::unbox_s(self.Str)));
61 61
     }
62 62
 
2  src/core/EnumMap.pm
@@ -40,7 +40,7 @@ my class EnumMap does Associative {
40 40
     }
41 41
 
42 42
     multi method perl(EnumMap:D:) {
43  
-        'EnumMap.new('
  43
+        self.^name ~ '.new('
44 44
             ~ self.keys.map({ .perl ~ ', ' ~ self.at_key($_).perl ~ ', '}).join
45 45
             ~ ')';
46 46
     }
9  src/core/Exception.pm
... ...
@@ -1,3 +1,4 @@
  1
+my class Failure { ... }
1 2
 my role X::Comp { ... }
2 3
 my class X::ControlFlow { ... }
3 4
 
@@ -32,6 +33,14 @@ my class Exception {
32 33
         pir::setattribute__vPsP($!ex, 'payload', nqp::p6decont(self));
33 34
         nqp::rethrow($!ex)
34 35
     }
  36
+
  37
+    method fail(Exception:D:) {
  38
+        try self.throw;
  39
+        my $fail := Failure.new($!);
  40
+        my Mu $return := pir::find_caller_lex__Ps('RETURN');
  41
+        $return($fail) unless nqp::isnull($return);
  42
+        $fail
  43
+    }
35 44
 }
36 45
 
37 46
 my class X::AdHoc is Exception {
213  src/core/IO.pm
... ...
@@ -1,4 +1,5 @@
1 1
 my class X::IO::Copy { ... }
  2
+my class X::IO::Dir  { ... }
2 3
 
3 4
 sub print(|$) {
4 5
     my $args := pir::perl6_current_args_rpa__P();
@@ -27,14 +28,71 @@ sub prompt($msg) {
27 28
     $*IN.get;
28 29
 }
29 30
 
30  
-class IO {
  31
+my role IO::FileTestable {
  32
+    method d() {
  33
+        self.e && nqp::p6bool(nqp::stat(nqp::unbox_s($.path), pir::const::STAT_ISDIR))
  34
+    }
  35
+
  36
+    method e() {
  37
+        nqp::p6bool(nqp::stat(nqp::unbox_s($.path), pir::const::STAT_EXISTS))
  38
+    }
  39
+
  40
+    method f() {
  41
+        self.e && nqp::p6bool(nqp::stat(nqp::unbox_s($.path), pir::const::STAT_ISREG))
  42
+    }
  43
+
  44
+    method l() {
  45
+        nqp::p6bool(pir::new__Ps('File').is_link(nqp::unbox_s($.path)))
  46
+    }
  47
+
  48
+    method r() {
  49
+        nqp::p6bool(pir::new__Ps('OS').can_read(nqp::unbox_s($.path)))
  50
+    }
  51
+
  52
+    method s() {
  53
+        self.e 
  54
+          && nqp::p6bool(
  55
+              nqp::isgt_i(
  56
+                  nqp::stat(nqp::unbox_s($.path), 
  57
+                                 pir::const::STAT_FILESIZE),
  58
+                  0))
  59
+    }
  60
+
  61
+    method w() {
  62
+        nqp::p6bool(pir::new__Ps('OS').can_write(nqp::unbox_s($.path)))
  63
+    }
  64
+
  65
+    method x() {
  66
+        nqp::p6bool(pir::new__Ps('OS').can_execute(nqp::unbox_s($.path)))
  67
+    }
  68
+    
  69
+    method z() {
  70
+        self.e && self.s == 0;
  71
+    }
  72
+
  73
+    method modified() {
  74
+         nqp::p6box_i(nqp::stat(nqp::unbox_s($.path), pir::const::STAT_MODIFYTIME));
  75
+    }
  76
+
  77
+    method accessed() {
  78
+         nqp::p6box_i(nqp::stat(nqp::unbox_s($.path), pir::const::STAT_ACCESSTIME));
  79
+    }
  80
+
  81
+    method changed() { 
  82
+         nqp::p6box_i(nqp::stat(nqp::unbox_s($.path), pir::const::STAT_CHANGETIME));
  83
+    }
  84
+
  85
+}
  86
+
  87
+class IO does IO::FileTestable {
31 88
     has $!PIO;
32 89
     has Int $.ins = 0;
33 90
     has $.chomp = Bool::True;
34 91
     has $.path;
35 92
 
36 93
     proto method open(|$) { * }
37  
-    multi method open($path, :$r, :$w, :$a, :$bin, :$chomp = Bool::True) {
  94
+    multi method open($path, :$r, :$w, :$a, :$bin, :$chomp = Bool::True,
  95
+            :enc(:$encoding) = 'utf8') {
38 96
         my $mode = $w ?? 'w' !! ($a ?? 'wa' !! 'r');
39 97
         # TODO: catch error, and fail()
40 98
         nqp::bindattr(self, IO, '$!PIO',
@@ -44,7 +102,7 @@ class IO {
44 102
         );
45 103
         $!path = $path;
46 104
         $!chomp = $chomp;
47  
-        $!PIO.encoding($bin ?? 'binary' !! 'utf8');
  105
+        $!PIO.encoding($bin ?? 'binary' !! PARROT_ENCODING($encoding));
48 106
         self.buffer_type(:line);
49 107
         self;
50 108
     }
@@ -133,6 +191,11 @@ class IO {
133 191
         nqp::p6bool(nqp::istrue($!PIO));
134 192
     }
135 193
 
  194
+    method t() {
  195
+        self.opened && nqp::p6bool($!PIO.isatty)
  196
+    }
  197
+
  198
+
136 199
     proto method print(|$) { * }
137 200
     multi method print(IO:D: Str:D $value) {
138 201
         $!PIO.print(nqp::unbox_s($value));
@@ -174,62 +237,6 @@ class IO {
174 237
         nqp::p6box_s($!PIO.readall());
175 238
     }
176 239
 
177  
-    method d() {
178  
-        self.e && nqp::p6bool(nqp::stat(nqp::unbox_s($!path), pir::const::STAT_ISDIR))
179  
-    }
180  
-
181  
-    method e() {
182  
-        nqp::p6bool(nqp::stat(nqp::unbox_s($!path), pir::const::STAT_EXISTS))
183  
-    }
184  
-
185  
-    method f() {
186  
-        self.e && nqp::p6bool(nqp::stat(nqp::unbox_s($!path), pir::const::STAT_ISREG))
187  
-    }
188  
-
189  
-    method l() {
190  
-        nqp::p6bool(pir::new__Ps('File').is_link(nqp::unbox_s($!path)))
191  
-    }
192  
-
193  
-    method r() {
194  
-        nqp::p6bool(pir::new__Ps('OS').can_read(nqp::unbox_s($!path)))
195  
-    }
196  
-
197  
-    method s() {
198  
-        self.e 
199  
-          && nqp::p6bool(
200  
-              nqp::isgt_i(
201  
-                  nqp::stat(nqp::unbox_s($!path), 
202  
-                                 pir::const::STAT_FILESIZE),
203  
-                  0))
204  
-    }
205  
-
206  
-    method t() {
207  
-        self.opened && nqp::p6bool($!PIO.isatty)
208  
-    }
209  
-
210  
-    method w() {
211  
-        nqp::p6bool(pir::new__Ps('OS').can_write(nqp::unbox_s($!path)))
212  
-    }
213  
-
214  
-    method x() {
215  
-        nqp::p6bool(pir::new__Ps('OS').can_execute(nqp::unbox_s($!path)))
216  
-    }
217  
-    
218  
-    method z() {
219  
-        self.e && self.s == 0;
220  
-    }
221  
-
222  
-    method modified() {
223  
-         nqp::p6box_i(nqp::stat(nqp::unbox_s($!path), pir::const::STAT_MODIFYTIME));
224  
-    }
225  
-
226  
-    method accessed() {
227  
-         nqp::p6box_i(nqp::stat(nqp::unbox_s($!path), pir::const::STAT_ACCESSTIME));
228  
-    }
229  
-
230  
-    method changed() { 
231  
-         nqp::p6box_i(nqp::stat(nqp::unbox_s($!path), pir::const::STAT_CHANGETIME));
232  
-    }
233 240
 
234 241
     # not spec'd
235 242
     method copy($dest) {
@@ -259,6 +266,70 @@ class IO {
259 266
     }
260 267
 }
261 268
 
  269
+my class IO::Path is Cool does IO::FileTestable {
  270
+    has Str $.basename;
  271
+    has Str $.dir = '.';
  272
+
  273
+    multi method Str(IO::Path:D:) {
  274
+        self.basename;
  275
+    }
  276
+    multi method gist(IO::Path:D:) {
  277
+        "{self.^name}<{self.path}>";
  278
+    }
  279
+    multi method Numeric(IO::Path:D:) {
  280
+        self.basename.Numeric;
  281
+    }
  282
+    method Bridge(IO::Path:D:) {
  283
+        self.basename.Bridge;
  284
+    }
  285
+    method Int(IO::Path:D:) {
  286
+        self.basename.Int;
  287
+    }
  288
+
  289
+    method path(IO::Path:D:) {
  290
+        $.dir eq '.' ?? $.basename !! join('/', $.dir, $.basename);
  291
+    }
  292
+
  293
+    method IO(IO::Path:D:) {
  294
+        IO.new(:$.path);
  295
+    }
  296
+}
  297
+
  298
+my class IO::File is IO::Path {
  299
+    method open(IO::File:D: *%opts) {
  300
+        open($.path, |%opts);
  301
+    }
  302
+}
  303
+
  304
+my class IO::Dir is IO::Path {
  305
+    method contents() {
  306
+        dir($.path);
  307
+    }
  308
+}
  309
+
  310
+sub dir(Cool $path = '.', Mu :$test = none('.', '..')) {
  311
+    my Mu $RSA := pir::new__PS('OS').readdir(nqp::unbox_s($path.Str));
  312
+    my int $elems = pir::set__IP($RSA);
  313
+    my @res;
  314
+    loop (my int $i = 0; $i < $elems; $i = $i + 1) {
  315
+        my Str $file := nqp::p6box_s(nqp::atpos($RSA, $i));
  316
+        if $file ~~ $test {
  317
+            my $f = IO::File.new(:basename($file), :dir($path.Str));
  318
+            @res.push: $f.d ?? IO::Dir.new(:basename($file), :dir($path.Str)) !! $f;
  319
+        }
  320
+    }
  321
+    return @res.list;
  322
+
  323
+    CATCH {
  324
+        default {
  325
+            X::IO::Dir.new(
  326
+                :$path,
  327
+                os-error => .Str,
  328
+            ).throw;
  329
+        }
  330
+    }
  331
+}
  332
+
262 333
 my class X::IO::Unlink { ... }
263 334
 sub unlink($path) {
264 335
     pir::new__PS('OS').unlink($path);
@@ -288,8 +359,8 @@ sub rmdir($path) {
288 359
 }
289 360
 
290 361
 proto sub open(|$) { * }
291  
-multi sub open($path, :$r, :$w, :$a, :$bin, :$chomp = Bool::True) {
292  
-    IO.new.open($path, :$r, :$w, :$a, :$bin, :$chomp);
  362
+multi sub open($path, :$r, :$w, :$a, :$bin, :$chomp = Bool::True, :enc(:$encoding) = 'utf8') {
  363
+    IO.new.open($path, :$r, :$w, :$a, :$bin, :$chomp, :$encoding);
293 364
 }
294 365
 
295 366
 proto sub lines(|$) { * }
@@ -337,26 +408,6 @@ multi sub cwd() {
337 408
     }
338 409
 }
339 410
 
340  
-my class X::IO::Dir { ... }
341  
-sub dir($path = '.', Mu :$test = none('.', '..')) {
342  
-    my Mu $RSA := pir::new__PS('OS').readdir(nqp::unbox_s($path.Stringy));
343  
-    my int $elems = pir::set__IP($RSA);
344  
-    my @res;
345  
-    loop (my int $i = 0; $i < $elems; $i = $i + 1) {
346  
-        my Str $file := nqp::p6box_s(nqp::atpos($RSA, $i));
347  
-        @res.push: "$path/$file".IO if $test.ACCEPTS($file);
348  
-    }
349  
-    return @res;
350  
-
351  
-    CATCH {
352  
-        default {
353  
-            X::IO::Dir.new(
354  
-                :$path,
355  
-                os-error => .Str,
356  
-            ).throw;
357  
-        }
358  
-    }
359  
-}
360 411
 
361 412
 my class X::IO::Chdir { ... }
362 413
 proto sub chdir(|$) { * }
4  src/core/Int.pm
@@ -46,10 +46,6 @@ my class Int does Real {
46 46
         nqp::p6box_s(nqp::chr(nqp::unbox_i(self)));
47 47
     }
48 48
 
49  
-    method succ(Int:D:) { self + 1 }
50  
-
51  
-    method pred(Int:D:) { self - 1 }
52  
-
53 49
     method sqrt(Int:D:) { nqp::p6box_n(nqp::sqrt_n(nqp::tonum_I(self))) }
54 50
 
55 51
     method base(Int:D: Cool $base) {
9  src/core/Mu.pm
@@ -407,11 +407,14 @@ multi sub infix:<~~>(Mu \$topic, Mu \$matcher) {
407 407
     $matcher.ACCEPTS($topic).Bool;
408 408
 }
409 409
 
410  
-sub infix:<=:=>(Mu \$x, Mu \$y) { 
411  
-    nqp::p6bool(nqp::iseq_i(nqp::where($x), nqp::where($y)));
  410
+proto sub infix:<=:=>($a?, $b?) { * }
  411
+multi sub infix:<=:=>($a?)      { Bool::True }
  412
+multi sub infix:<=:=>(Mu \$a, Mu \$b) { 
  413
+    nqp::p6bool(nqp::iseq_i(nqp::where($a), nqp::where($b)));
412 414
 }
413 415
 
414  
-proto sub infix:<eqv>(Any $, Any $) { * }
  416
+proto sub infix:<eqv>(Any $?, Any $?) { * }
  417
+multi sub infix:<eqv>($a?)            { Bool::True }
415 418
 multi sub infix:<eqv>(Any $a, Any $b) {
416 419
     $a.WHICH eq $b.WHICH
417 420
 }
3  src/core/Numeric.pm
@@ -20,6 +20,9 @@ my role Numeric {
20 20
     multi method Bool(Numeric:D:) { self != 0 }
21 21
 
22 22
     multi method gist(Numeric:D:) { self.Str }
  23
+
  24
+    method succ() { self + 1 }
  25
+    method pred() { self - 1 }
23 26
 }
24 27
 
25 28
 multi sub infix:<eqv>(Numeric $a, Numeric $b) {
3  src/core/Real.pm
@@ -78,9 +78,6 @@ my role Real does Numeric {
78 78
         $int_part == 0 && self < 0 ?? '-' ~ $r !! $r;
79 79
     }
80 80
 
81  
-    method succ() { self.Bridge.succ }
82  
-    method pred() { self.Bridge.pred }
83  
-
84 81
     method Real(Real:D:) { self }
85 82
     method Bridge(Real:D:) { self.Num }
86 83
     method Int(Real:D:) { self.Bridge.Int }
13  src/core/Str.pm
@@ -454,13 +454,16 @@ my class Str does Stringy {
454 454
     multi method gist(Str:D:) { self }
455 455
     multi method perl(Str:D:) {
456 456
         my $result = '"';
  457
+        my $icu = $*VM<config><has_icu>;
457 458
         for ^self.chars -> $i {
458 459
             my $ch = self.substr($i, 1);
459  
-            $result ~= %esc{$ch} // (nqp::iscclass(
460  
-                                            pir::const::CCLASS_PRINTING,
461  
-                                            nqp::unbox_s($ch), 0)
462  
-                                      ?? $ch
463  
-                                      !! $ch.ord.fmt('\x[%x]'));
  460
+            $result ~= %esc{$ch} 
  461
+                       //  (   ((!$icu && $ch.ord >= 256)
  462
+                               || nqp::iscclass( pir::const::CCLASS_PRINTING,
  463
+                                                  nqp::unbox_s($ch), 0))
  464
+                           ?? $ch
  465
+                           !! $ch.ord.fmt('\x[%x]')
  466
+                           );
464 467
         }
465 468
         $result ~ '"'
466 469
     }
10  src/core/metaops.pm
@@ -15,9 +15,9 @@ sub METAOP_REVERSE(\$op) {
15 15
     -> Mu \$a, Mu \$b { $op($b, $a) }
16 16
 }
17 17
 
18  
-sub METAOP_CROSS(\$op) {
  18
+sub METAOP_CROSS(\$op, &reduce) {
19 19
     -> **@lol {
20  
-        my $rop = @lol.elems == 2 ?? $op !! METAOP_REDUCE($op);
  20
+        my $rop = @lol.elems == 2 ?? $op !! &reduce($op);
21 21
         my @l;
22 22
         my @v;
23 23
         @l[0] = (@lol[0].flat,).list;
@@ -39,9 +39,9 @@ sub METAOP_CROSS(\$op) {
39 39
     }
40 40
 }
41 41
 
42  
-sub METAOP_ZIP(\$op) {
  42
+sub METAOP_ZIP(\$op, &reduce) {
43 43
     -> **@lol {
44  
-        my $rop = METAOP_REDUCE($op);
  44
+        my $rop = @lol.elems == 2 ?? $op !! &reduce($op);
45 45
         my @l = @lol.map({ (.flat,).list.item });
46 46
         gather {
47 47
             my $loop = 1;
@@ -53,7 +53,7 @@ sub METAOP_ZIP(\$op) {
53 53
     }
54 54
 }
55 55
 
56  
-sub METAOP_REDUCE(\$op, :$triangle) {
  56
+sub METAOP_REDUCE_LEFT(\$op, :$triangle) {
57 57
     my $x := $triangle ??
58 58
         (sub (*@values) {
59 59
             return () unless @values.gimme(1);
3  src/core/traits.pm
@@ -52,6 +52,9 @@ multi trait_mod:<is>(Routine:D $r, :$rw!) {
52 52
 multi trait_mod:<is>(Routine:D $r, :$default!) {
53 53
     $r does role { method default() { True } }
54 54
 }
  55
+multi trait_mod:<is>(Routine:D $r, :$DEPRECATED!) {
  56
+    # we'll add logic here later
  57
+}
55 58
 multi trait_mod:<is>(Routine:D $r, :$inlinable!) {
56 59
     $r.set_inline_info($inlinable);
57 60
 }
2  tools/build/NQP_REVISION
... ...
@@ -1 +1 @@
1  
-2012.06-11-gfcc9a23
  1
+2012.06.1-14-g5a8707b

0 notes on commit a2da68c

Please sign in to comment.
Something went wrong with that request. Please try again.