> * I'm pretty sure i saw something like :!$test to express Bool :$test = False.
> Did i just dreamed about it ?

You sort of dreamed it.  :!test passes test => False as a Pair, which means 
$test = False.
But that's syntax for calling the fn, not declaring it.  You could do Bool() 
:$test=0, but
imo that's not readable enough to be worthwhile. (In my own code, I typically 
write 
Bool :$test=False without spaces for the default value (even though I use them 
when `=` is
assignment rather than a default) and I find that clearer).

> * more importantly, is the a better choice than
> 
> +@files or @files = ('-');
> my $argfiles = IO::ArgFiles.new(@files);
> .&fixline.say for $argfiles.lines

The tighter precedence of || lets you inline the first line:

    my $argfiles = IO::ArgFiles.new(@files || '-');
   .&fixline.say for $argfiles.lines

Or the whole thing, if you prefer:

    .&fixline.say for IO::ArgFiles.new(@files || '-');
    
> This would be fair enough in any other languages but the whole thing looks
> unelegant in a raku code.

The other change I'd suggest for additional elegance (at least imo) is to put
the help text for each flag/option on the same line, either by putting it after
with #= or by using an embedded comment.  Here's the script with those changes:

   sub MAIN (
   #|[don't fix for real, just show the diff]              Bool :$diff=False,
   #|[input files (stdin by default or with explicit '-')] *@files ) {
       .&fixline.say for IO::ArgFiles.new(@files || '-').lines;
   }


Hope that helps!

-codesections

Reply via email to