- Timestamp:
- 10/16/08 18:33:01 (3 months ago)
- Files:
-
- 1 modified
-
docs/Perl6/Perl5/Differences.pod (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
docs/Perl6/Perl5/Differences.pod
r22629 r22630 153 153 etc. 154 154 155 Parenthesis don't construct lists any more, they merely group. Lists are156 constructed with the comma operator. It has looser precedence than the list155 Parenthesis don't construct lists, they merely group. Lists are 156 constructed with the comma operator. It has tighter precedence than the list 157 157 assignment operator, which allows you to write lists on the right hand side 158 wi htout parens:158 without parens: 159 159 160 160 my @list = 1, 2, 3; # @list really has three elements 161 161 162 The arrow operator C<< -> >> for derefer ncing is gone. Since (nearly)163 everything is a reference, you can directly use the ap ropriate pair of164 parenthes is for either indexing or method calls:162 The arrow operator C<< -> >> for dereferencing is gone. Since (nearly) 163 everything is a reference, you can directly use the appropriate pair of 164 parentheses for either indexing or method calls: 165 165 166 166 my $lol = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; … … 317 317 Now: $object.method 318 318 319 =head2 Using code references in dynamic method calls is gone. 320 321 Was: $self.$coderef() 322 Now: $coderef(self:) 319 =head2 Dynamic method calls distinguish symbolic refs from hard refs 320 321 Was: $self->$method() 322 Now: $self.$method() # hard ref 323 Now: $self."$method"() # symbolic ref 323 324 324 325 =cut … … 331 332 changing their behaviour for particular types is a simple as adding the 332 333 appropriate multi subs and methods. If you want these to be globally 333 available, you have to but them into the C<GLOBAL> namespace, which is 334 indicated by an asterisk. 335 336 multi sub *uc(TurkishStr $str) { ... } 334 available, you have to but them into the C<GLOBAL> namespace: 335 336 multi sub GLOBAL::uc(TurkishStr $str) { ... } 337 337 338 338 # "overload" the string concatenation: … … 398 398 # XXX needs some brave rewrite 399 399 400 =head1 Documentation401 402 You now use <em>kwid</em> for documentation instead of POD. Kwid403 is a wiki-like syntax that is easy to write, and pleasant to read directly.404 405 Here is a side-by-side comparison of some of the major features of Pod and406 Kwid:407 408 =head1 Big Thing = Big Thing409 410 =head4 Small Thing ==== Small Thing411 412 A paragraph of A paragraph of413 plain text. plain text.414 415 # verbatim # verbatim416 sub v { sub v {417 shift; shift;418 } }419 420 421 =item * foo * foo422 =item * bar * bar423 =item2 N<> barber ++ barber424 =item2 N<> bard ++ bard425 426 427 Something B<strong>! Something *strong*!428 429 Something I<emphatic>! Something /emphatic/!430 431 Some code C<E = M * C ^ 2>! Some code `E = M * C ^ 2`!432 433 Some V<B<escaped>> markup Some \*escaped\* markup434 435 =begin Section_type .Section_type436 437 =end Section_type !Section_type438 439 =for Section_type :Section_type440 441 See L<S26> for details.442 443 =cut444 445 #S29446 400 447 401 =head1 Builtin Functions … … 490 444 =head2 wantarray() 491 445 492 C<wantarray> is superse eded by C<want.list>. Also available are C<want.item>446 C<wantarray> is superseded by C<want.list>. Also available are C<want.item> 493 447 and C<want.count>, the latter gives the number of expected values, if 494 448 applicable. … … 512 466 distinctly block-related now, so in fact what you've got there is a 513 467 block that returns the value "February". The C<<>> and C<<<>>> forms 514 are in fact just quoting mechanisms (see below).468 are in fact just quoting mechanisms being used as subscripts (see below). 515 469 516 470 =head2 Built-in functions are now methods 517 471 518 Most (all?)built-in functions are now methods of built-in classes such472 Most built-in functions are now methods of built-in classes such 519 473 as C<String>, C<Array>, etc. 520 474
