Changeset 6926

Show
Ignore:
Timestamp:
09/10/05 21:49:40 (3 years ago)
Author:
iblech
Message:

* t/var/autoderef.t: Refs to subrefs should not autoderef.
* pugs::run: Added short paragraph about the features of our backends.
* PIL2JS: README: Added section about the implementation of laziness.

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lib/pugs/run.pod

    r6750 r6926  
    7272backends are C<Parrot> and C<PIR>. 
    7373 
    74 The JavaScript backend provides an interactive shell in 
     74The JavaScript backend (PIL2JS) provides an interactive shell in 
    7575F<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>. 
     76backend (PIL-Run) can be found in F<perl5/PIL-Run/crude_repl.pl>. 
     77 
     78The normal runcore supports more features than the other runcores, the Parrot 
     79backend is quite fast, PIL2JS is good on binding and references, and PIL-Run 
     80offers excellent support for laziness. 
    7781 
    7882=item C<-CI<backend>> 
  • perl5/PIL2JS/README

    r6830 r6926  
    479479=back 
    480480 
     481=head2 Laziness 
     482 
     483=head3 C<lazy {...}> 
     484 
     485PIL2JS fully supports nothingmuch's accepted C<lazy {...}> proposal (see 
     486F<t/var/lazy.t>). Only one real problem arose during implementing C<&lazy>: 
     487C<.FETCH> is called very often, for example at sub return (because of 
     488C<PIL2JS.Box.ReadOnly>). Therefore, C<&lazy>'s current implementation does not 
     489return the lazy value directly, but an autodereffing reference to it. This way 
     490the body is only called when it is really needed. 
     491 
     492=head3 Lazy lists 
     493 
     494Lazy lists aren't supported at all yet, you may want to look at PIL-Run if you 
     495want to experiment with lazy lists. 
     496 
    481497=head1 JAVASCRIPT RUNTIME ENVIRONMENTS 
    482498 
  • t/var/autoderef.t

    r5946 r6926  
    77# http://www.nntp.perl.org/group/perl.perl6.language/22532. 
    88 
    9 plan 18; 
     9plan 22; 
    1010 
     11# Refs to "non-objects" (in this case, a number) should not autoderef. 
    1112{ 
    1213  my $x = 3; 
     
    2122} 
    2223 
     24# Refs to "objects" (in this case, an array) should autoderef. 
    2325{ 
    2426  my @x = (1,2,3); 
     
    3436} 
    3537 
     38# Refs to "objects" (in this case, a hash) should autoderef. 
    3639{ 
    3740  my %x = (:a(1), :b(2), :c(3)); 
     
    4750} 
    4851 
     52# Refs to "non-objects" (in this case, a ref) should not autoderef. 
    4953{ 
    5054  my @x = (1,2,3); 
     
    5357 
    5458  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>; 
    5761 
    5862  @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)"; 
    6077} 
    6178