>>>>> "DC" == Damian Conway <[EMAIL PROTECTED]> writes:

  DC>      my %seen is shape(IO) of Bool;  # %seen maps IO objects to boolean 
values

  DC>      while get_next_input_stream() -> $in {
  DC>          next if %seen{$in};
  DC>          $text ~= slurp $in;
  DC>          %seen{$in} = 1;
  DC>      }

but that is doable in perl5 as well. $in would stringify to a unique key
and you can test for it. better is if you used those keys as io handles
and that is where perl5 loses. say you had to process a bunch of handles
(say sockets which aren't going to be closed) and wanted to pass the
ones that still need processing. then you would do something like this
(perl5ish syntax which won't really work):

        my %handles = map { open( $_, '<' ) or die "foo" => 1 } @files ;

later on some code could clear a handle's flag but leave the file open
and you can find the handles you want easily.

        process_handles( grep( $handles{$_}, keys %handles ) ) ;

my current workaround for this problem is to have a hash that maps a ref
to itself! the key is a stringified ref and the value is the real
ref. having the key be any value (but internally strringified for
hashing) is very needed.


  >>> But, y'know, this one almost convinces me. Especially when you consider:
  >>> 
  >>> sub func ($i, $j, $k) {...}
  >>> 
  >>> @x = func($a, [EMAIL PROTECTED], @z);

  DC> Which would again be more obvious as:

  DC>          @x = func($a, every(@y), @z);

i agree. i like the names there as it reads better.


  DC> PS: I'll be away for the rest of the week, but will happily continue to
  DC>      argue when I return. ;-)

so where do you go for an argument when you are away?

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to