From dpchrist at holgerdanske.com Sun Feb 1 17:31:40 2026 From: dpchrist at holgerdanske.com (David Christensen) Date: Sun, 1 Feb 2026 17:31:40 -0800 Subject: [sf-perl] Perl 5 script "future" revision 1.2 Message-ID: <250ed4b9-eb48-4911-a405-a9dd50a920c6@holgerdanske.com> Everyone: Thank you for the discussion on Zoom today regarding my Perl 5 script "future". Below please find an updated revision. David -- 2026-02-01 17:28:57 root at laalaa ~/sandbox/perl # cat future #!/usr/env/perl # $Id: future,v 1.2 2026/02/02 01:26:20 dpchrist Exp $ # By David Paul Christensen dpchrist at holgerdanske.com # Public Domain use strict; use warnings; package Future; sub new { my $class = shift; my $rc = shift; return bless(sub {return $rc->(@_)}, $class); } package main; use Test::More; our $FutureClass = "Future"; our $v = 'hello, world!'; sub future(&) { my $rc = shift; return bless(sub {return $rc->(@_)}, $FutureClass); } my $f = Future->new(sub { $v }); my $g = future { $v }; print $f->(), $/; print $g->(), $/; { local $v = 'goodbye, cruel world!'; print $f->(), $/; print $g->(), $/; } print $f->(), $/; print $g->(), $/; 2026-02-01 17:28:59 root at laalaa ~/sandbox/perl # perl future hello, world! hello, world! goodbye, cruel world! goodbye, cruel world! hello, world! hello, world! From gatorreina at gmail.com Sun Feb 1 17:53:46 2026 From: gatorreina at gmail.com (Richard Reina) Date: Sun, 1 Feb 2026 19:53:46 -0600 Subject: [sf-perl] Perl 5 script "future" revision 1.2 In-Reply-To: <250ed4b9-eb48-4911-a405-a9dd50a920c6@holgerdanske.com> References: <250ed4b9-eb48-4911-a405-a9dd50a920c6@holgerdanske.com> Message-ID: <34CD1A58-40FA-4AC5-9980-721D77467AA6@gmail.com> What exactly is this code supposed to do? > > On Feb 1, 2026, at 7:32?PM, David Christensen wrote: > > ?Everyone: > > Thank you for the discussion on Zoom today regarding my Perl 5 script "future". Below please find an updated revision. > > > David > > -- > > > 2026-02-01 17:28:57 root at laalaa ~/sandbox/perl > # cat future > #!/usr/env/perl > # $Id: future,v 1.2 2026/02/02 01:26:20 dpchrist Exp $ > # By David Paul Christensen dpchrist at holgerdanske.com > # Public Domain > > use strict; > use warnings; > > package Future; > > sub new > { > my $class = shift; > my $rc = shift; > return bless(sub {return $rc->(@_)}, $class); > } > > package main; > > use Test::More; > > our $FutureClass = "Future"; > > our $v = 'hello, world!'; > > sub future(&) > { > my $rc = shift; > return bless(sub {return $rc->(@_)}, $FutureClass); > } > > my $f = Future->new(sub { $v }); > my $g = future { $v }; > > print $f->(), $/; > print $g->(), $/; > > { > local $v = 'goodbye, cruel world!'; > print $f->(), $/; > print $g->(), $/; > } > > print $f->(), $/; > print $g->(), $/; > > > > 2026-02-01 17:28:59 root at laalaa ~/sandbox/perl > # perl future > hello, world! > hello, world! > goodbye, cruel world! > goodbye, cruel world! > hello, world! > hello, world! > > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > https://mail.pm.org/mailman/listinfo/sanfrancisco-pm From dpchrist at holgerdanske.com Sun Feb 1 19:53:24 2026 From: dpchrist at holgerdanske.com (David Christensen) Date: Sun, 1 Feb 2026 19:53:24 -0800 Subject: [sf-perl] Perl 5 script "future" revision 1.2 In-Reply-To: <34CD1A58-40FA-4AC5-9980-721D77467AA6@gmail.com> References: <250ed4b9-eb48-4911-a405-a9dd50a920c6@holgerdanske.com> <34CD1A58-40FA-4AC5-9980-721D77467AA6@gmail.com> Message-ID: <93a73762-54ca-4038-b959-a4562da1ed6a@holgerdanske.com> On 2/1/26 17:53, Richard Reina wrote: > What exactly is this code supposed to do? > >> On Feb 1, 2026, at 7:32?PM, David Christensen wrote: >> >> >> 2026-02-01 17:28:57 root at laalaa ~/sandbox/perl >> # cat future >> #!/usr/env/perl >> # $Id: future,v 1.2 2026/02/02 01:26:20 dpchrist Exp $ >> # By David Paul Christensen dpchrist at holgerdanske.com >> # Public Domain >> >> use strict; >> use warnings; >> >> package Future; >> >> sub new >> { >> my $class = shift; >> my $rc = shift; >> return bless(sub {return $rc->(@_)}, $class); >> } >> >> package main; >> >> use Test::More; >> >> our $FutureClass = "Future"; >> >> our $v = 'hello, world!'; >> >> sub future(&) >> { >> my $rc = shift; >> return bless(sub {return $rc->(@_)}, $FutureClass); >> } >> >> my $f = Future->new(sub { $v }); >> my $g = future { $v }; >> >> print $f->(), $/; >> print $g->(), $/; >> >> { >> local $v = 'goodbye, cruel world!'; >> print $f->(), $/; >> print $g->(), $/; >> } >> >> print $f->(), $/; >> print $g->(), $/; >> >> >> >> 2026-02-01 17:28:59 root at laalaa ~/sandbox/perl >> # perl future >> hello, world! >> hello, world! >> goodbye, cruel world! >> goodbye, cruel world! >> hello, world! >> hello, world! The code is supposed to test/ demonstrate the following capabilities in Perl 5. It is a thought exercise, not production quality, and likely contains conceptual and other defects: 1. Class "Future" with a class method (constructor) "new" that accepts a code reference as an argument and returns a copy of that code reference as an object. 2. When the object is invoked, the code reference runs and has access to variables within the caller's lexical scope. 3. If the caller localizes a variable, when invoked the code reference sees the localized value of the variable. 4. When the variable localization goes out of scope, when invoked the code reference sees the previous value of the variable. 5. Similar to the above, but the object is created by a subroutine (factory function) "future" with a prototype of "&" (block) to provide syntactic sugar. ("future" should be within package "Future", but I was unable to figure out how to get Exporter and "use qw(future)" working.) David From gatorreina at gmail.com Mon Feb 2 03:30:19 2026 From: gatorreina at gmail.com (Richard Reina) Date: Mon, 2 Feb 2026 05:30:19 -0600 Subject: [sf-perl] Perl 5 script "future" revision 1.2 In-Reply-To: <93a73762-54ca-4038-b959-a4562da1ed6a@holgerdanske.com> References: <93a73762-54ca-4038-b959-a4562da1ed6a@holgerdanske.com> Message-ID: Very interesting. Thank you for explaining. > > On Feb 1, 2026, at 9:53?PM, David Christensen wrote: > > ?On 2/1/26 17:53, Richard Reina wrote: >> What exactly is this code supposed to do? >>>> On Feb 1, 2026, at 7:32?PM, David Christensen wrote: >>> >>> >>> 2026-02-01 17:28:57 root at laalaa ~/sandbox/perl >>> # cat future >>> #!/usr/env/perl >>> # $Id: future,v 1.2 2026/02/02 01:26:20 dpchrist Exp $ >>> # By David Paul Christensen dpchrist at holgerdanske.com >>> # Public Domain >>> >>> use strict; >>> use warnings; >>> >>> package Future; >>> >>> sub new >>> { >>> my $class = shift; >>> my $rc = shift; >>> return bless(sub {return $rc->(@_)}, $class); >>> } >>> >>> package main; >>> >>> use Test::More; >>> >>> our $FutureClass = "Future"; >>> >>> our $v = 'hello, world!'; >>> >>> sub future(&) >>> { >>> my $rc = shift; >>> return bless(sub {return $rc->(@_)}, $FutureClass); >>> } >>> >>> my $f = Future->new(sub { $v }); >>> my $g = future { $v }; >>> >>> print $f->(), $/; >>> print $g->(), $/; >>> >>> { >>> local $v = 'goodbye, cruel world!'; >>> print $f->(), $/; >>> print $g->(), $/; >>> } >>> >>> print $f->(), $/; >>> print $g->(), $/; >>> >>> >>> >>> 2026-02-01 17:28:59 root at laalaa ~/sandbox/perl >>> # perl future >>> hello, world! >>> hello, world! >>> goodbye, cruel world! >>> goodbye, cruel world! >>> hello, world! >>> hello, world! > > The code is supposed to test/ demonstrate the following capabilities in Perl 5. It is a thought exercise, not production quality, and likely contains conceptual and other defects: > > 1. Class "Future" with a class method (constructor) "new" that accepts a code reference as an argument and returns a copy of that code reference as an object. > > 2. When the object is invoked, the code reference runs and has access to variables within the caller's lexical scope. > > 3. If the caller localizes a variable, when invoked the code reference sees the localized value of the variable. > > 4. When the variable localization goes out of scope, when invoked the code reference sees the previous value of the variable. > > 5. Similar to the above, but the object is created by a subroutine (factory function) "future" with a prototype of "&" (block) to provide syntactic sugar. ("future" should be within package "Future", but I was unable to figure out how to get Exporter and "use qw(future)" working.) > > > David > From doomvox at gmail.com Thu Feb 12 00:38:08 2026 From: doomvox at gmail.com (Joseph Brenner) Date: Thu, 12 Feb 2026 00:38:08 -0800 Subject: [sf-perl] The SF Perl Raku Study Group, 02/15 at 1pm PST Message-ID: Patti Smith, "Land" off of "Horses" (1975) (paraphrased): Up there, there is a sea the sea's the possibility There is no land... There is no sea... But the sea sea of possibilites There is no keeper of the keys Except for one who sees his possibilities, One who seizes possibilities, up there I see the first possibility, the sea around me Dip in-- to the sea, the sea of possibilities ... I handed him a branch of coral flame in the heart of man The Raku Study Group Sunday, February 15, 2026 1pm in California, 9pm in the UK An informal meeting: drop by when you can, show us what you've got, ask and answer questions, or just listen and lurk. Perl and programming in general are fair game, along with Raku, Zoom meeting link: https://us02web.zoom.us/j/87386386163?pwd=oSPxaPCaNbCY3lUlOhORxamQjmMAKg.1 Passcode: 4RakuRoll Information about upcoming meetings can always be found here: https://github.com/doomvox/raku-study/blob/main/README.md -------------- next part -------------- An HTML attachment was scrubbed... URL: