SPUG: It gaugtht bettuh...

Mark Hinds zoro98020 at gmail.com
Fri Jul 8 07:01:35 PDT 2016


Dyck, David wrote:
> It's been a while since I read
>     http://perldoc.perl.org/perlref.html#Function-Templates
>
> Did you see this note at the bottom:
>     CAVEAT: Aliasing does not work correctly with closures. If you try to alias lexical variables from an inner subroutine or eval, the aliasing will only be visible within that inner sub, and will not affect the outer subroutine where the variables are declared. This bizarre behavior is subject to change.

Hi Dave,

Interesting, but I'd never even think use such a construct. Even if I did
want to create a local function it could simply put it into a simple
my variable and all would be well, no?

HandleEvent(SomeEvent, sub {
     my $x = $_[0] + 23;
     my $localFunc = sub { return $x *2 };
     return $localFunc->();
});






> -----Original Message-----
> From: spug-list [mailto:spug-list-bounces+david.dyck=fluke.com at pm.org] On Behalf Of Mark Hinds
> Sent: Thursday, July 7, 2016 7:06 AM
> To: SPUG Members <spug-list at pm.org>
> Subject: SPUG: It gaugtht bettuh...
>
>
> OK, it looks like this list isn't quite dead yet... :-)
>
> I've been using perl since sometime back in the 90's.
>
> I ended up using it in an embedded linux system about 10 years ago
> to replace a guile based scripting engine - That's one ugly M...
>
> I used mod Event to create a pure event system to handle bunches of
> serial IO and timer events. Worked/works great. Perl is a quite
> a CPU big, but still compares well with other dynamic languages.
>
> Seems that Python has taken over from Perl these days. I never liked
> Python - using indention as fundamental element of syntax is obnoxious - IMHO.
>
> I suppose Perl's goofy syntax make people cringe - I find it a rather
> charming idiosyncrasy myself :-)
>
> Question - Perl's anonymous functions seem to operate perfectly well
> as closures - they capture the referenced environment properly and
> free it when they themselves are no longer referenced. The guile
> folks disputed that me those many years ago. Thoughts?
>
>
>
>
>
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
>       POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>      MEETINGS: 3rd Tuesdays
>      WEB PAGE: http://seattleperl.org/
>



More information about the spug-list mailing list