While implementing S26, it occurred to me that there may be cause to document certain things that aren't declarations. For example, augment:
#| This should probably add to, or perhaps replace MyClass.WHY?
augment class MyClass {
}
Or perhaps a return value?
sub multiply(
#| The multiplicand
Int $a,
#| The multiplier
Int $b
#| The product
--> Int
) { $a * $b }
If I have multiple consecutive #|
or #=
comments on a single declaration, they should be merged into one, right? For example:
#| One
#| Two
sub decl() {}
#= Three
#= Four
is &decl.WHY.leading, 'One Two';
is &decl.WHY.trailing, 'Three Four';
In Perl 5, one can re-open (or dup
) a file handle like so:
open my $copy, '>&', \*STDOUT;
This is normally done to fiddle with standard I/O handles before handing off control to a child process or something. I was thinking that this would be a good idea to add to Perl 6, accomplished by providing an existing IO::Handle
to open
:
my ( $read, $write ) = create-pipe;
if $child {
$read.close;
$*OUT = open($write);
# exec child
}
Thoughts?