Changeset 20097 for docs/Perl6/Spec

Show
Ignore:
Timestamp:
03/10/08 23:30:15 (9 months ago)
Author:
buchetc
Message:

[t\spec] smartlink issues

Location:
docs/Perl6/Spec
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • docs/Perl6/Spec/Concurrency.pod

    r20091 r20097  
    269269=over 
    270270 
    271 =item Coro as function used in a builtin 
     271=item Coro as a function 
    272272 
    273273  coro dbl { yield $_ * 2; yield $_; }; 
     
    276276 
    277277  # coro parameters 
    278   coro perm ( @x ) { 
    279      my @y = @x; # need a copy 
    280      while @x { @y.splice($_,1).yield; } 
     278  coro perm ( @x is copy ) { 
     279      while @x { @x.splice($_,1).yield; } 
    281280  } 
    282281 
     
    327326 
    328327   async { 
    329       say "my tid is ", +self(); 
     328      say "my tid is ", +self; 
    330329   }; 
    331330 
     
    349348the CC currently running in that thread 
    350349 
    351  
    352350=item wake_on_readable, wake_on_writable, wake_on 
    353351 
    354352TODO: IO objects and containers gets concurrency love! 
    355353 
    356  - $obj.wake_on_either_readable_or_writable_or_passed_time(3); # fixme fixme 
    357  - $obj.wake_on:{.readable} # busy wait, probably 
    358  
    359     my @a is Array::Chan = 1..Inf; 
    360     async { @a.push(1) }; 
    361     async { @a.blocking_shift({ ... }) }; 
    362     async { @a.unshift({ ... }) }; 
    363  
     354 $obj.wake_on_either_readable_or_writable_or_passed_time(3); # fixme fixme 
     355 $obj.wake_on:{.readable} # busy wait, probably 
     356 
     357 my @a is Array::Chan = 1..Inf; 
     358 async { @a.push(1) }; 
     359 async { @a.blocking_shift({ ... }) }; 
     360 async { @a.unshift({ ... }) }; 
    364361 
    365362=back 
     
    543540Live in userland for the time being. 
    544541 
    545 =head2 Interprocess Communication 
    546  
    547 =head2 I/O Considerations 
    548  
    549 =head3 File Descriptors 
    550  
    551 =head3 Sockets 
    552  
    553542 
    554543=head2 Still more or less unorganized stuff 
     
    591580### INTERFACE BARRIER ### 
    592581 
    593 =head3 braindump of coro meeting by Liz and Autri, more to follow 
    594  
    595 - Coros are _like_ processes 
    596  
    597  
    598   coro foo ($x) { 
    599     yield $x; 
    600     yield $x+2; 
    601     cleanup(); 
    602     while (2) { 
    603         while (1) { 
    604             &?SUB.kill; # seppuku 
    605         } 
    606     } 
    607   } # implicit falloff return + return() means start over without yielding 
    608     # return() means yielding and restart + no implicit falloff (I LIKE THIS) 
    609  
    610   foo(4); # and that's all she wrote 
    611  
    612   sub foo { 
    613      return undef if rand; 
    614      ... 
    615   } 
    616  
    617   use overload { 
    618     '&{}' => sub { ... } 
    619   } 
    620  
    621   class Coro is Conc::Multiplex does Code { 
    622      method postcircumfix:<( )> { 
    623          # start the thread, block stuff (we are in the caller's context) 
    624      } 
    625   } 
    626  
    627   class Hash is extended { 
    628     method postcircumfix:<( )> (&self: *@_) { 
    629         &self = self.start(@_); 
    630     } 
    631     method start { 
    632         # remember self 
    633         # upon return() or normal falloff, restore self 
    634     } 
    635   } 
    636  
    637   %*ENV(123); 
    638  
    639  
    640   # continuation coros 
    641   multi foo () { ...no rebinding... } 
    642   multi foo ($x) { ...rebinding... } 
    643  
    644   &foo.kill; 
    645  
    646  
    647   my $first_ret = zoro( type => <even> ); 
    648   &zoro.variant(:type<even>).kill; 
    649   &zoro.variant(type => 'even').kill; 
    650  
    651   zoro( type => <odd> ); 
    652  
    653   zoro( even => 1 ); 
    654   zoro( odd => 1 ); 
    655  
    656   multi coro zoro ($type where 'even') {} 
    657   multi coro zoro ($type where 'odd') {} 
    658  
    659   multi coro zoro ($even is named) {} 
    660   multi coro zoro ($odd is named) {} 
    661  
    662  
    663   # iblech's thoughts: 
    664   # Coroutine parameters should never be rebound. Instead, yield(...)s return 
    665   # value is an Arglist object containing the new arguments: 
    666   coro bar ($a, $b) { 
    667     ...; 
    668     my $new_set_of_args = yield(...); 
    669     my $sum_of_old_a_and_new_a = $a + $new_set_of_args<$a>; 
    670     ...; 
    671   } 
    672   bar(42, 23);  # $a is 42, $b is 23 
    673   bar(17, 19);  # $a still 42, $b still 19, 
     582=head2 See also 
     583 
     584=over 
     585 
     586=item * 
     587 
     588L<S16/Interprocess Communication> 
     589 
     590=item * 
     591 
     592L<S16/I/O Considerations> 
     593 
     594=item * 
     595 
     596L<S16/File Descriptors> 
     597 
     598=item * 
     599 
     600L<S16/Sockets> 
     601 
     602=back 
    674603 
    675604=cut 
  • docs/Perl6/Spec/IO.pod

    r16189 r20097  
    499499   ($r, $w) = Socket.pair(AF_UNIX, SOCK_STREAM, PF_UNSPEC); 
    500500 
     501 
    501502=back 
    502503 
     
    505506Please post errors and feedback to perl6-language.  If you are making 
    506507a general laundry list, please separate messages by topic. 
     508 
     509=cut