[perl #130479] [BUG] Type coercion in signature gives warning on optional named arguments

2018-02-12 Thread Zoffix Znet via RT
On Wed, 17 Jan 2018 15:48:31 -0800, c...@zoffix.com wrote:
> On Sun, 01 Jan 2017 09:06:32 -0800, dougljenk...@gmail.com wrote:
> > I would expect this code to ignore the conversion of $foo if no value is
> > passed for it.
> > 
> > $ perl6 -e 'sub (Int(Cool) :$foo){}()'
> > 
> > Use of uninitialized value of type Cool in numeric context
> >   in sub  at -e line 1
> > 
> > IRC discussion: https://irclog.perlgeek.de/perl6/2017-01-01#i_13832608
> 
> 
> Thank you for the report. This is now fixed in branch `post-release`.
> 
> Fix:  https://github.com/rakudo/rakudo/commit/ae697080d2d5225
> Test: https://github.com/perl6/roast/commit/6457b4fab81809c5a


This has been reverted for now, in light of 
https://github.com/rakudo/rakudo/issues/1517
(and somewhat https://github.com/rakudo/rakudo/issues/1519 too)

We need to figure out how/whether handle the cases whether the two types of
the coercer aren't subclasses and I rather we don't push the original fix into
a release before we do that.

Keeping this Issue as resolved, with the problem being continued on 
https://github.com/rakudo/rakudo/issues/1517


[perl #130479] [BUG] Type coercion in signature gives warning on optional named arguments

2018-02-12 Thread Zoffix Znet via RT
On Wed, 17 Jan 2018 15:48:31 -0800, c...@zoffix.com wrote:
> On Sun, 01 Jan 2017 09:06:32 -0800, dougljenk...@gmail.com wrote:
> > I would expect this code to ignore the conversion of $foo if no value is
> > passed for it.
> > 
> > $ perl6 -e 'sub (Int(Cool) :$foo){}()'
> > 
> > Use of uninitialized value of type Cool in numeric context
> >   in sub  at -e line 1
> > 
> > IRC discussion: https://irclog.perlgeek.de/perl6/2017-01-01#i_13832608
> 
> 
> Thank you for the report. This is now fixed in branch `post-release`.
> 
> Fix:  https://github.com/rakudo/rakudo/commit/ae697080d2d5225
> Test: https://github.com/perl6/roast/commit/6457b4fab81809c5a


This has been reverted for now, in light of 
https://github.com/rakudo/rakudo/issues/1517
(and somewhat https://github.com/rakudo/rakudo/issues/1519 too)

We need to figure out how/whether handle the cases whether the two types of
the coercer aren't subclasses and I rather we don't push the original fix into
a release before we do that.

Keeping this Issue as resolved, with the problem being continued on 
https://github.com/rakudo/rakudo/issues/1517


Open files by given name and extension and ask for deletion

2018-02-12 Thread mimosinnet
After a while, a bunch of files asking for cleanup rest in some folders (like 'downloads'). 

This script allows to see whats in a set of 'pattern.extension' files 
(using Linux xdg-open) and asks for deletion (moving to the /tmp 
folder). 

I leave it here for consideration and improvement. Also, it may be 
helpful to other Perl6 newcomers.


Happy Perl6!

---
#!/usr/bin/env perl6
use v6;

#| Opens 'pattern.ext' files and asks for deletion. Write 'all' for 
selecting all files.

sub MAIN( $pattern is copy, Str $ext ) {

$pattern = "" if $pattern eq "all";
my @files = '.'.IO.dir(test => /.*$pattern.*\.$ext/);

for @files -> $file {
my @args = 'xdg-open', $file.basename;
my $command = run @args;
$command.exitcode == 0 or die "system @args failed: $!";
my $delete = prompt("\n \n Delete file $file (s/n) ");
last if $delete eq "";
next if $delete ne "s";
say "mv $file /tmp/$file";
$file.IO.rename("/tmp/$file");
prompt("\n Press 'return' to continue ");
}

@files = '.'.IO.dir(test => /.*$ext$/);
say "-" x 60;
for @files -> $file { $file.Str.say }
say "-" x 60;
}
---

--
(≧∇≦) Mimosinnet (Linux User: #463211)