Changeset 6926
- Timestamp:
- 09/10/05 21:49:40 (3 years ago)
- Files:
-
- 3 modified
-
lib/pugs/run.pod (modified) (1 diff)
-
perl5/PIL2JS/README (modified) (1 diff)
-
t/var/autoderef.t (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lib/pugs/run.pod
r6750 r6926 72 72 backends are C<Parrot> and C<PIR>. 73 73 74 The JavaScript backend provides an interactive shell in74 The JavaScript backend (PIL2JS) provides an interactive shell in 75 75 F<perl5/PIL2JS/jspugs.pl>; The interactive compiler and evaluator of the Perl 5 76 backend can be found in F<perl5/PIL-Run/crude_repl.pl>. 76 backend (PIL-Run) can be found in F<perl5/PIL-Run/crude_repl.pl>. 77 78 The normal runcore supports more features than the other runcores, the Parrot 79 backend is quite fast, PIL2JS is good on binding and references, and PIL-Run 80 offers excellent support for laziness. 77 81 78 82 =item C<-CI<backend>> -
perl5/PIL2JS/README
r6830 r6926 479 479 =back 480 480 481 =head2 Laziness 482 483 =head3 C<lazy {...}> 484 485 PIL2JS fully supports nothingmuch's accepted C<lazy {...}> proposal (see 486 F<t/var/lazy.t>). Only one real problem arose during implementing C<&lazy>: 487 C<.FETCH> is called very often, for example at sub return (because of 488 C<PIL2JS.Box.ReadOnly>). Therefore, C<&lazy>'s current implementation does not 489 return the lazy value directly, but an autodereffing reference to it. This way 490 the body is only called when it is really needed. 491 492 =head3 Lazy lists 493 494 Lazy lists aren't supported at all yet, you may want to look at PIL-Run if you 495 want to experiment with lazy lists. 496 481 497 =head1 JAVASCRIPT RUNTIME ENVIRONMENTS 482 498 -
t/var/autoderef.t
r5946 r6926 7 7 # http://www.nntp.perl.org/group/perl.perl6.language/22532. 8 8 9 plan 18;9 plan 22; 10 10 11 # Refs to "non-objects" (in this case, a number) should not autoderef. 11 12 { 12 13 my $x = 3; … … 21 22 } 22 23 24 # Refs to "objects" (in this case, an array) should autoderef. 23 25 { 24 26 my @x = (1,2,3); … … 34 36 } 35 37 38 # Refs to "objects" (in this case, a hash) should autoderef. 36 39 { 37 40 my %x = (:a(1), :b(2), :c(3)); … … 47 50 } 48 51 52 # Refs to "non-objects" (in this case, a ref) should not autoderef. 49 53 { 50 54 my @x = (1,2,3); … … 53 57 54 58 ok !$z.isa("Array"), "refs to Refs should not autoderef", :todo<bug>; 55 dies_ok { +$z }, "refs to Refs don't numify ", :todo<bug>;56 dies_ok { ~$z }, "refs to Refs don't stringify ", :todo<bug>;59 dies_ok { +$z }, "refs to Refs don't numify (1)", :todo<bug>; 60 dies_ok { ~$z }, "refs to Refs don't stringify (1)", :todo<bug>; 57 61 58 62 @x = (); 59 ok ?$z, "refs to Refs always booleanify to true", :todo<bug>; 63 ok ?$z, "refs to Refs always booleanify to true (1)", :todo<bug>; 64 } 65 66 # Refs to "non-objects" (in this case, a subref) should not autoderef. 67 { 68 my $x = { 42 }; 69 my $y = \$x; 70 71 ok !$y.isa("Code"), "refs to subrefs should not autoderef", :todo<bug>; 72 dies_ok { +$y }, "'real refs' don't numify (2)"; 73 dies_ok { ~$y }, "'real refs' don't stringify (2)", :todo<bug>; 74 75 $x = undef; 76 ok ?$y, "'real refs' always booleanify to true (2)"; 60 77 } 61 78
