> 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
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
> 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
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