If one uses MAIN with arguments, one simply cannot get strings like
"Bool::True" and "True" from the command line into the same argument,
regardless of whether one uses no type constraint, a Str, a Str(), or a
slurpy. See the quote below from rakudo #2794
<https://github.com/rakudo/rakudo/issues/2794> for an example.

I think a built-in EnumStr Perl 6 type is necessary to fix this—though it's
arguable that since CLI's are, for the most part, string-native, an
argument type-constrained to Str on MAIN should get absolutely anything the
shell hands it untouched.

Are there any other candidate types MAIN's parser reads that don't have
allomorphic counterparts, or will EnumStr fix the issue entirely?

Trey

---------- Forwarded message ---------
From: Trey Harris <notificati...@github.com>
Date: Mon, Mar 25, 2019 at 14:38
Subject: Re: [rakudo/rakudo] `MAIN`: `Str` arguments do not accept `True`
or `False` (#2794)
To: rakudo/rakudo <rak...@noreply.github.com>

I think an 'EnumStr' is a requirement, actually, after considering this
example:

% ./cat-p6 *@*ARGS is ["cat-p6"]=== cat-p6 ===#!/usr/bin/env perl6
unit sub MAIN(*@files);
say '@*ARGS is ', @*ARGS.perl;
for @files -> $f {  say "=== $f ===";  put $f.IO.lines.join("\n");}
% for file in 42 hi True Bool::True; dofor> echo "This is $file" >
$filefor> done
% ls42  Bool::True  True  cat-p6  hi
% ./cat-p6 *@*ARGS is ["42", "Bool::True", "True", "cat-p6", "hi"]===
42 ===This is 42=== True ===This is True=== True ===This is True===
cat-p6 ===#!/usr/bin/env perl6
unit sub MAIN(*@files);
say '@*ARGS is ', @*ARGS.perl;
for @files -> $f {  say "=== $f ===";  put $f.IO.lines.join("\n");}===
hi ===This is hi

Without taking over @*ARG handling, it's impossible to access the file
named "Bool::True". That can't be right.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/rakudo/rakudo/issues/2794#issuecomment-476326725>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAF-Z2fX2ObnpCh9LaJ_0pP0YbHYYjQFks5vaRe9gaJpZM4cF0i0>
.

Reply via email to