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

Eh? Going away? What's the corresponding Perl 6 construct and how/why is it considered to be "cleaner"?
  • Comment on Re^3: What about if (my $var = foo()) { ... }

Replies are listed 'Best First'.
Re^4: What about if (my $var = foo()) { ... }
by Limbic~Region (Chancellor) on Dec 29, 2007 at 16:49 UTC
    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

      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.