Re: rw optional parameters

2017-09-17 Thread Elizabeth Mattijsen
> On 17 Sep 2017, at 01:45, Norman Gaywood wrote: > Still, I wonder if the compiler should have error'ed before I actually tried > to assign to the variable at run-time. > > The compiler should know that I can't do: > > sub MAIN( :$debug = False, :$verbose = False ) { > $verbose = True if

Re: rw optional parameters

2017-09-16 Thread Norman Gaywood
On 16 September 2017 at 23:29, Elizabeth Mattijsen wrote: > > > On 16 Sep 2017, at 13:32, Norman Gaywood wrote: > > sub MAIN( :$debug = False, :$verbose is rw = False ) { > > ... > > $ ./tt.p6 --debug > > ===SORRY!=== Error while compiling /home/ngaywood/./tt.p6 > > Cannot use 'is rw' on option

Re: rw optional parameters

2017-09-16 Thread Elizabeth Mattijsen
> On 16 Sep 2017, at 13:32, Norman Gaywood wrote: > > I have this: > #!/usr/bin/perl6 > use v6; > sub MAIN( :$debug = False, :$verbose = False ) { > $verbose = True if $debug; > say "verbose={$verbose}, debug={$debug}"; > } > $ ./tt.p6 > verbose=False, debug=False > $ ./tt.p6 --verbose

rw optional parameters

2017-09-16 Thread Norman Gaywood
I have this: #!/usr/bin/perl6 use v6; sub MAIN( :$debug = False, :$verbose = False ) { $verbose = True if $debug; say "verbose={$verbose}, debug={$debug}"; } $ ./tt.p6 verbose=False, debug=False $ ./tt.p6 --verbose verbose=True, debug=False $ ./tt.p6 --debug Cannot assign to a readonly var