> In the original report, an argument can be made that the programmer ought to 
> have made the program more useful by writing
> 
>    sub MAIN (Int $integer) { ... }

What if there are two integer params? MAIN (Int $integer1, Int $integer2) looks 
bad and subroutine body may be hard to understand.
We already have typed variable and choosing variable name to duplicate type 
name just to display this information to caller is redundant.

Despite that I found another inconsistency in positional params - anonymous one 
still display types:

$ perl6 -e 'sub MAIN (Int, Str) { ... }'
Usage:
  -e '...' <Int> <Str>


Maybe more consistent way of displaying types would be "--age=<Int> 
--name=<Str>" for named and "<Int>age <Str>name" for named positionals and 
"<Int> <Str>" for anonymous positionals?




> On 26 May 2015, at 20:01, Patrick R. Michaud via RT 
> <perl6-bugs-follo...@perl.org> wrote:
> 
> On Tue May 26 08:38:30 2015, b...@post.pl wrote:
>> I think this is bug because type is more important than irrelevant
>> variable name.
>> Expected output is: "Usage:␤  /tmp/tmpfile <Int>"
> 
> In this case, the variable name is "irrelevant" primarily because the 
> programmer chose an irrelevant name.  A clearer case for the current behavior 
> comes from
> 
>   sub MAIN (Int $count!) { ... }
> 
> which produces a more useful  "Usage:␤  /tmp/tmpfile <count>"  message.
> 
> Or consider a grep-like replacement:
> 
>   sub MAIN ($pattern!, @*files) { ... }
> 
> that produces "Usage:␤  /tmp/tmpfile <pattern> [<files> ...]".
> 
> 
> In the original report, an argument can be made that the programmer ought to 
> have made the program more useful by writing
> 
>    sub MAIN (Int $integer) { ... }
> 
> which outputs "Usage:␤  /tmp/SJk_VxNAxM <integer>".
> 
> I'm inclined to reject this ticket, but will leave it open for further 
> discussion.
> 
> Pm
> 
> 
> 
> 

Reply via email to