Islands in the byte stream


RFC: A new syntax to give a method an extra block

In Shibuya.pm#12, I have proposed a new syntax to Perl, which allows to give a method an extra block like Ruby.

For example:

File->open('<', $file) {
  my($io) = @_;
  $io->grep{ /^foo/ }->each{ say @_ };

This is simply interpreted as:

File->open('<', $file, sub{
  my($io) = @_;
  $io->grep(sub { /^foo/ })->each(sub { say @_ });

This is only a sugar to the Perl syntax. That is, we need not add any opcode/ppcode to the core. And this syntax is not conflict with the current syntax. Therefore it does not break backward compatibility.

The patch is available on my github space:

What do you think of it?

(I have posted this idea to p5p no title)