in reply to Re^3: What about if (my $var = foo()) { ... }
in thread What about if (my $var = foo()) { ... }

esper,
See Re: What about if (my $var = foo()) { ... } for the Perl 6 construct.

Regarding an explanation as to why formal parameters to a block are cleaner, it is similar to subs with and without signatures. If that still doesn't make any sense, I will try again when I am well rested.

Cheers - L~R

  • Comment on Re^4: What about if (my $var = foo()) { ... }

Replies are listed 'Best First'.
Re^5: What about if (my $var = foo()) { ... }
by dsheroh (Monsignor) on Dec 29, 2007 at 18:46 UTC
    Thanks for the pointer. I haven't been following Perl 6 at all, so some of the new syntax I'm seeing in Synopsis 4 is still a bit unclear, but I'm pretty sure I've at least got the formal parameters bit worked out. Personally, I think it looks less obvious/consistent than the existing Perl 5 equivalent (use my to create lexicals in some situations, use -> or ^ in others) for the small benefit of eliminating implicit scopes, but I can easily see how others would disagree, given the number of complaints I've seen about subs always starting with a bunch of mys and shifts.